Wednesday, March 4, 2009

IIS Reset - don't do if your team uses different sharepoint webapplications for development

Our sharepoint development team works on a single development machine - which is the norm in most SP teams as we don't want our desktop running windows server 2003 or our bosses do not want virtual pc hosted on our machines.

Now each one, while developing, creates a webapplication for oneself and starts experimenting - which is ok as we clear up unused webapplications at regular intervals. The problem however was this - everyone, usually after deploying their dll in GAC (that is often), restarts iis with iisreset. And most often you hear this command entry followed by howls like "hey who restarted iis just now" "hey what yaar, please" from various quarters within the team.

This is how we solved it.. we first understood that each sharepoint webapp has its own application pool.. if you read further you will know about http.sys - the driver which listens to ports and captures http requests coming in and after consulting mr. iismetabase decides on which application pool to assign the request to. now for each application pool a process can be created - w3wp.exe - and runs under the identity of the apppool configured identity. multiple websites can use one apppool - that way compromising benefits of isolation for performance.

once we understood and realized that every sharepoint webapp has an apppool of its own which has a w3wp.exe of its own.. we looked at easier ways of restarting the apppool rather than whole iis.. so we created the following bat file and placed it in c:/windows/system32

Recycle.bat

cscript.ext c:\windows\system32\iisapp.vbs /a %1 /r

simple right.. now we just use iisapp to find our application pool - which is done only once.. and everytime we need to restart we just call

Recycle "[[my apppool]]"

or

Recycle "sharepoint - 2438"

and that is when no one complains... which is good!!

No comments: