What is the difference between allowing a precompiled Visual Studio Web Page to be updatable and not?
Asked Answered
T

2

25

I've built a web site several times using the default "allow this precompiled site to be updatable" however on the most recent compile the website was very broken. After playing around with the .dll's (deleting and replacing them, in the bin) I noticed certain parts of the website starting to work again, but if I put all of the original .dll's in the site was broken.

I'm using aspx pages with several Ajax web extensions. These were added recently and may be the source of the problem. I unchecked the "Allow this precompiled site to be updatable" and it added all kinds of extra compiled code files to the bin, and all the problems with the website went away... what's going on here? What was the difference?

There doesn't seem to be any difference in the way I update the site either, just a straight publish from Visual Studio each time.

Any insights would be appreciated.

Tolerance answered 15/8, 2012 at 19:22 Comment(0)
M
23

Unchecking the "Allow this precompiled site to be updatable" compiles the .Aspx Pages, not just the code files (.VB/.CS). Leaving it checked allows you to make certain changes to the .Aspx files after it has been deployed without recompiling (ex = move the position of a control or add some additional HTML markup).

After reading your description of the deployment issues it seems more likely that the errors are because IIS needs the App Pool refreshed. On a low end VPS, sometimes it just makes sense to bounce (restart) it if you have that luxury.

Read the following MSDN articles for more information on Site Precompilation.

http://msdn.microsoft.com/en-us/library/399f057w(v=vs.80).aspx

http://msdn.microsoft.com/en-us/library/ms247286(v=vs.80).aspx

Meneses answered 15/8, 2012 at 20:31 Comment(0)
T
7

I have an answer for my own questions, based on what NoAlias said. I read the two links and found the following:

Precompiling for Deployment Only
When you precompile for deployment only, the compiler produces assemblies from virtually all ASP.NET source files that are normally compiled at run time. This includes program code in pages, .cs and .vb class files, other code files, and resource files. The compiler removes all source and markup from the output. In the resulting layout, compiled files are generated for each of the .aspx files (with the extension .compiled) that contain pointers to the appropriate assembly for that page. To change the Web site, including the layout of pages, you must change the original files, recompile the site, and redeploy the layout. The only exception is the site configuration; you may make changes to the Web.config file on the production server without having to recompile the site. This option provides the greatest degree of protection for your pages and the best performance at startup.

Precompiling for Deployment and Update
When you precompile for deployment and update, the compiler produces assemblies from all source code (except page code in single-file pages) and from other files that normally produce assemblies, such as resource files. The compiler converts .aspx files into single files that use the compiled code-behind model and copies them to the layout. This option enables you to make limited changes to the ASP.NET Web pages in your site after compiling them. For example, you can change the arrangement of controls, colors, fonts, and other appearance aspects of pages. You can also add controls, as long as they do not require event handlers or other code. When the site runs the first time, ASP.NET performs further compilation in order to create output from the markup. Note

A precompiled updatable site does not allow multiple pages to reference the same CodeFile class.

I had recently made changes to the site to include 2 aspx pages that referenced the same CodeFile (the same VB code in the background) Each page had slightly different html properties, but needed to have identical CodeFiles, so for my second ASP page I deleted the auto-generated VB code file and then referenced a different CodeFile in the HTML.

As Stated above, precompiled updateable sites do not allow multiple pages to reference the same code-file class. Which is why some of my pages weren't working.

From this point on, I need to avoid using the default checkbox "Allow this precompiled site to be updatable"; It must remain unchecked for my website to utilize the VB CodeFiles referenced my multiple pages.

Conclusion: Multiple aspx pages referencing the same CodeFile need to be precompiled to run correctly. This means the site will not be able to have any changes made to it without re-deplyoying.

Tolerance answered 20/8, 2012 at 14:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.