views:

3090

answers:

2

I've created a web deployment project using the template for Visual Studio 2008 for a ASP.NET 3.5 web application (not web site).

I compiled the project which created the files needed for deployment. I copied the resulting folders (bin, static files and all folders with the aspx placeholders etc.) to a staging server where I wanted to test the application.

If I don't flag the option "Allow this precompiled site to be updatable", I get this error message on every page I load in the browser:

System.Web.HttpException file PAGENAME.aspx has not been pre-compiled, 
and cannot be requested.

the last line in the stack trace:

System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(
  VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, 
  Boolean allowBuildInPrecompile) +8756366

If I check the option, everything is fine (I guess because the actual aspx/ascx are still there in their original form).

Any idea what I am missing here? Is there some setting or special file I forgot to copy?

Thank you!

Notes:

  • I have a few references to third-party assemblies
  • I've checked the bin folder on the staging server. It contains the precompiled assembly which contains all classes (I used Reflector to analyze the assembly).
+3  A: 

All the ASPX files should only contain

This is a marker file generated by the precompilation tool, and should not be deleted!

Delete everything in your bin folder and publish the web again. Make sure you take the files from the directory where you did the publishing.

Make sure you copy the .compiled files contained in the bin folder too.

Richard L
Thank you for your answer! It did not contain the exact solution, but it led me to re-check the bin folders. I forgot to insert the ".compiled" files in my automated copy procedure to the server. I'll edit your answer and I'll accept it.
splattne
A: 

For the record, I forgot to copy these ".compiled" files (MSDN documentation: File Handling During ASP.NET Precompilation):

For executable files in an ASP.NET Web application, the compiler assemblies and files with the .compiled file name extension. The assembly name is generated by the compiler. The .compiled file does not contain executable code. Instead, it contains only the information that ASP.NET needs to find the appropriate assembly.

After the precompiled application is deployed, ASP.NET uses the assemblies in the Bin folder to process requests. The precompilation output includes .aspx or .asmx files as placeholders for pages. The placeholder files contain no code. They exist only to provide a way to invoke ASP.NET for a specific page request and so that file permissions can be set to restrict access to the pages.

splattne