title: Seamless deployment in ASP.NET (IIS kills worker process before new worker process is ready)
body: <p>I am trying to deploy a .NET Web application to IIS (7.5) without any hassle for the users. I have made sure that <strong><em>Disable Overlapped Recycle is False</em></strong> but i still run into the same problem every time.</p>
  
  <p>Every time I upload new binaries for the site, IIS kills the worker process before it has started a new one. So every time I upload new binaries users get this error message:</p>
  
  <blockquote>
    <p>Server Error in '/' Application. Could
    not load file or assembly
    'MyApplicationWeb' or one of its
    dependencies. The process cannot
    access the file because it is being
    used by another process. (Exception
    from HRESULT: 0x80070020)</p>
  </blockquote>
  
  <p>I have no idea how to do this seamless. As it is now I just upload the binary; but while the upload occurs (or local copy) it will give the above quoted behaviour. I also tried using a Web garden but with same result.</p>
  
  <p>What I am not looking for:</p>
  
  <ul>
  <li>How to solve it with external load balancers (it's a functional solution but it is perfomance wise a bad solution for few servers and it won't work at all if there's only one server)</li>
  <li>How to create a hack-around with a refresh in a custom error page (as it has some obvious problems but more importantly wont work at all with web services/ajax).</li>
  </ul>
  
  <p>I really think this should be doable given <a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/24e3c22e-79a9-4f07-a407-dbd0e7f35432.mspx?mfr=true">http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/24e3c22e-79a9-4f07-a407-dbd0e7f35432.mspx?mfr=true</a></p>
  
  <p>Update:
  In article above they say:</p>
  
  <blockquote>
    <p>However, because the shutdown timeout
    value of a shutdown or startup is
    configurable, the worker process can
    be terminated while it is still
    serving requests if it does not finish
    servicing existing requests within the
    time limit.</p>
  </blockquote>
  
  <p>I have no idea where to find this value nor what it's default. If its less then a few second it might explain my results.</p>
  
  <p>ps. <em>I am posting it on SO rather than on SF/Webmasters etc because I think this kind of knowledge will probably be minimal amongst people who aren't active in development, I hope this is all right.</em></p>