Really resetting IIS

If you are developing ASP.Net web sites with IIS on your local machine it's not very uncommon to update libraries and sometimes IIS just gets messed up, something along the lines of "Could not load file of assembly...".

My recipe for this kind of issues is usually something like:

  • clean + rebuild from Visual Studio
  • iisreset
If that doesn't work, then I might get desperate and do this:
  • iisreset /stop
  • delete the web site from IIS Manager
  • delete the "bin" and "obj" folders for the project
  • restart Visual Studio
  • restart Windows
  • leave the room and start over (!)
But today, I've remembered that somewhere in between, it might be useful to delete the Temporary ASP.NET files, thanks to StackOverflow.

So, why not automatize this in a batch file? Here the prototype for my "really_clean_iis.bat":
@echo off

echo stopping IIS...
iisreset /stop

rem del %TEMP%\Temporary ASP.NET Files\*.*

echo deleting temporary ASP.NET files for .NET 2.0/4.0 32/64 bit...
del C:\Windows\Microsoft.NET\Framework\v2.0.50727\"Temporary ASP.NET Files"\*.* /s /q
del C:\Windows\Microsoft.NET\Framework\v4.0.30319\"Temporary ASP.NET Files"\*.* /s /q
del C:\Windows\Microsoft.NET\Framework64\v2.0.50727\"Temporary ASP.NET Files"\*.* /s /q
del C:\Windows\Microsoft.NET\Framework64\v4.0.30319\"Temporary ASP.NET Files"\*.* /s /q

echo starting IIS..
iisreset /start

No comments:

Post a Comment