开发者

How do I prevent IIS from compiling website?

I have an ASP .NET web application which on the backend is talking to an ASMX web service. We have counted and the average wait time for the initial request is 20s. I am wondering if there is a way I can send the web service up to the server precompiled, thus negating the need for compilation.

We have also noticed that IIS tends to recycle its worker threads and this also causes a compilation. The process itself is not accessed terribly often, but it needs to be much quicker when it is.

Any thoughts?

Thanks in adv开发者_C百科ance

Update: thanks to all the suggestions, I have tried a number of them and here is what I have found. Recycle time shutdown/tinkering is dangerous cause I dont want threads to just sit around doing nothing. Upon further inspection the site is going up precompiled, so my question is why is there an initial spin up time for a web service?

Right now: Leaning towards the warmup script suggestion below

Update: The service is being hit from a web server on a different machine. We are seeing problems with the initial request only.


One alternative approach is to write a "warm-up script" which simply executes one page from your app. This will make the server spin-up for you and the next person will get a fast hit. You could also set a scheduled process to run that script occasionally (like, if you schedule the thread pool to recycle at 4 am, schedule the warm-up script to run at 4:01 am)


You should be looking to perform precompliation as part of your build/deploy scripts.

Having a post-deployment activity to programatically request each web resource and trigger compliation seems pretty daft to me.

Thomas' answer gives the compiler, there's also a guide over at the MSDN, How to: Precompile ASP.NET Web Sites.

If you're using MSBuild then go for the AspNetCompiler Task.

(I probably would have made this a comment but I'm not yet allowed... not enough SO juice)


Have you tried using aspnet_compiler in the framework folder (e.g. %SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727)?

You can control ASP.NET recycling via the settings on the Application Pool. If it is recycling more often than the settings then something else is causing that (e.g. changes to the web.config etc.)


Try to disable application recyling in the configuration of the page or application pool in the IIS.

IIS 6 (If i remember correctly): Rightclick on AppPool -> Tab "Performance" -> Uncheck "Shut down working process on idle time"

IIS 7.5 There is property (seems to be an appPool settings too) that shuts down the AppPool after X minutes of idling time. The value 0 is equal to "never shut down"

Hope this helps


At a previous position we had similar issues with WCF services when initially spooling up we bypassed this by creating a simple program that would invoke all our web services after a deployment.

You could also use this same type of program as a keep alive service and just ping the services every 5-10 minutes etc.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜