Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm using a simple cmd batch file to deploy my Asp.net MVC web application to server network share.

The problem I'm having is that my DLLs can't be simply replaced by new files since existing ones are in use by the IIS. I'm not an admin on the server so I don't have rights to run iisreset remotely.

What I can do is I can open root web.config file and save it, hence forcing IIS to stop my web application and as a result to this I can replace my assemblies.


Since I deploy my app using an automated batch file I'd like to include this web.config file re-save inside it before I start deploying DLLs. Anybody knows how can this be done in cmd? Maybe a change of the file's last modified timestamp would suffice.

Possibile solution

I suppose I could as well write a console application that would change last modified timestamp to DateTime.Now but I don't want to write the code myself. Anyone knows of such existing code on the net, since I can't find it. Or even a command prompt tool (console app without user interaction)?

share|improve this question
Have you asked your admins for permission to be able to reset your app? –  Zypher Jul 13 '11 at 23:57
@Zypher: What do you mean by reset your app? Permission for iisreset is local admin... I'm not getting this kind of permission level. :) –  Robert Koritnik Jul 14 '11 at 0:13
No there are ways to give you permissions, also you can reset individual web apps / app pools w/o resetting the whole server –  Zypher Jul 14 '11 at 0:57
Also you need to work with you systems team not just work around it because resetting things tends to set off alarms. And that will make the systems people very not happy –  Zypher Jul 14 '11 at 0:58
@Zypher: If you know of the setting that need to be set and how to run application reset afterwards, you're free to provide an answer so I can accept it. –  Robert Koritnik Jul 14 '11 at 1:28

1 Answer 1

I would advise against doing this. It is at the very best a hack that will sometimes work.

First off, I'm not sure when the server restart is actually triggered. It is one of:

  • IIS monitors the web.config file, and if it's changed, kills the app domain. The next time someone visits the site, it starts the app domain again.
  • When someone visits the site, if IIS sees web.config has been modified, it restarts the app domain.

I'd bet it is probably the second way, which means that even if you modify the web.config, IIS will start back up and so you'll have the same problem.

Even if it's the first way, it's very likely that someone will visit the site before you start deploying, or even worse, part-way through.

  • This will mean some or all of your files won't deploy, and possibly your website will stop functioning if you have mixed DLLs.
  • Even worse, new code or HTML templates get deployed but new CSS or images don't, and so your site is partially broken (and not even in a way that's easy to programmatically detect).

The better ways to do this will all require some level of access to remotely execute applications on the server.

  • VS2010 has web deployment projects that work well.
  • You can use a 3rd party installer product (such as Advanced Installer, which has some specific IIS deployment features).
    • I actually use this product, and have my build server execute psexec to run the installer in silent mode. It's a one-click deployment to all of my internal testing systems, but could just as easily go to production and can also be automated to happen nightly or on every code checkin.
share|improve this answer
It's the first one. When I resave web.config I can immediately replace files without a problem. And it stays that way until I make a new request to application. So I can also wait before replacing files as long as no request has been made to app. –  Robert Koritnik Jul 14 '11 at 9:59
Since this app is in dev stage and only 3 users using it I can quite easily schedule DLL upgrades so their request won't interfere with my upgrade. And BTW... only DLLs get locked. Any other static files (aspx, css, js, images) are easily replaceable during execution. –  Robert Koritnik Jul 14 '11 at 10:00
One fact I intentionally left out is that I'm deploying this to a Sharepoitnt 2010 site. I don't think I'm allowed to run installers... And even if I used Advanced installer when would it schedule installation? It would face the same problem wouldn't it? It would have to be run in admin context to stop IIS application pool of my app. –  Robert Koritnik Jul 14 '11 at 10:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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