开发者

When is <Compilation> used in ASP.net

开发者 https://www.devze.com 2023-01-04 22:51 出处:网络
I\'m having some trouble setting the ExecutionTimeout element in my applications web.config. My page is making a lengthy webservice call and times out after 110 seconds开发者_JAVA技巧. (the default I

I'm having some trouble setting the ExecutionTimeout element in my applications web.config.

My page is making a lengthy webservice call and times out after 110 seconds开发者_JAVA技巧. (the default I believe). I set the value to 220, and make sure the compilation debug=false.

Does the compilation setting refer to when IIS/ASP.net compiles the ASPX pages when a client requests them, or does it refer to the visual studio compile process there the assemblies are created.

Would using an assembly built using debug in visual studio still allow the above settings to work?


IIS does not compile aspx pages when people request them. If you have a 'web application project' in VS, you compile all of your code behinds and other class files before you deploy. If you have a 'web site project' in VS, then the web server compiles your app on first request only. After either one of these happen, the application is not compiled again until you make a change.

With that information in mind above, this is when the compilation debug = true | false comes into play. Having debug = true, you get some pretty detailed information back on errors and other events but it can make your app run slower as debug symbols are inserted into the .dll and overall, it is not optimized for performance. By setting debug = false, you don't get quite the same level of error reporting, but you do get your performance gains back.

If you build in VS, it will build according to the settings in the web.config unless it is an external .dll/class project that you are including. If that is the case, the web.config settings mean nothing to that .dll and will run regardless of what combination of debug = false|true you have on those two projects.


Compilation tag is used to add referenced libraries for compilation by IIS or Visual Studio and to specify debug and batch compilation modes.

Speaking of debug attribute, here's good article with all the details in Milan Negovan blog.

And about compilation itself.

There are 3 modes of compilation. They are fully described in MSDN Overview.

By default web application uses updateable precompilation: all .cs files are compiled into one assembly, but all pages, controls and master pages are compiled on demand into new derived class.

Web Site project uses in-place compilation by default.

And non-updateable full precompilation must be specified explicitly. And here when compilation tag comes in. If batch="true" then all pages in application will be compiled upon first request to any page. This moves us to yet another story about big applications :)

Note that there are some other specifics in compilation model, look into ASP.NET Precompilation Overview if you really need this.


IIS compiles ASPX pages (and ASCX UserControls, ASHX, ASMX, ...) the first time they are requested. It also dynamically compiles:

  • Code in the App_Code folder

  • Code in code-beside pages for a website project

The compilation element in web.config refers to this compilation.

If you are using a Web Application Project in Visual Studio, your ASPX pages will have a code-behind file. This is compiled into a DLL when the project is built in Visual Studio, and won't be affected by the web.config compilation element.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号