I have an asp.net 4 e-commerce web site on my Windows Server 2008 R2 web server. I upload an updated DLL to the /bin folder and of course the site recompiles. It's a web site project, not web application. More times than not the site will not come back up, I'll get a service unavailable error (503 I think). I have to RDP into the server and do an IISRESET to bring it back up. Unfortunately this cycles everything on the server.

Why does this happen and how can I prevent it? How can I have the site recompile successfully when the /bin folder changes and not have IIS time out or whatever is causing this error?

Thank you.


That's a race condition between ASP.NET and the deployment. As the first application file or folder is touched, there will be an appdomain recycle, which will occur in rapid succession during the deployment. If it ends out of order, ASP.NET can be thrown off and remain in a broken state. This doesn't happen for most apps, but it can for some, especially those large sites under high load during deployment.

The solution is to 'touch' your web.config file after everything is finished. That will cause an appdomain recycle for just your site, and not require a reset on the whole server. By touch, just upload web.config again after your deployment has been completed.

Another option is to use App_Offline.htm during deployment.

Here are a couple video blogs I released on AppDomains and localized recycling that you may find useful:

  • Thanks Scott. I just uploaded 5 new DevExpress DLL's into the /bin (updated versions of prior ones) and also updated the web.config for the new version references. This time I used an App_Offline.htm and the site still choked and did not recover once the .htm was removed. Not sure what's going on. I'm increase the recompile timeout and see if that helps. – Neal Apr 22 '11 at 19:07
  • Did you do another push of just the web.config file last? I assume that you get it working. Did you do an iisreset or just an app pool recycle this time? – Scott Forsyth - MVP Apr 22 '11 at 21:11
  • recycling the individual site or AppPool doesn't seem to do it. I did not try touching the web.config once it went down, I did an IISRESET as it's the known cure. I'll try touching the web.config next time and maybe cycling the apppool next time and see what happens. I think the recompile after changes for the complex site is just taking too long and IIS is failing due to a timeout? – Neal Apr 23 '11 at 12:36
  • It's possible that it's a timeout issue, although if it's resolved with an iisreset, an app pool recycle should also fix it, and an appdomain recycle will 'likely' fix it. Any chance you have other sites on the same server that depend on each other? If so, that may be why a full iisreset seems to do the trick. – Scott Forsyth - MVP Apr 23 '11 at 19:23
  • Increasing the timeout in the AppPool seemed to do the trick. Uploaded changes today and the site didn't fail. Thx for the replies. – Neal Apr 25 '11 at 16:54

Did you register the dlls? Regsvr32 and the DLLs path. If it is 32-bit you would want to use the regsvr32 in the syswow64 folder.Another thing you can do is to enable failed request tracing in IIS to find out exactly where and what the issue is. Hope this helps

  • No, they are .NET DLL's so they just get xcopied into the /bin – Neal Apr 22 '11 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.