If you do SharePoint development you tend to run IISRESET a great deal each time you deploy new webpart assemblies to the GAC. This isn't the greatest solution because it can take a good amount of time and if you have multiple servers running it will take all of them down not to mention any users/testers get the dreaded "Service unavailable" screen.
Well, apparently, there is a better way! I found the following information here:
When deploying new versions of Webparts to the GAC, the general recommendation is to subsequentially run IISReset, since Sharepoint will not reload GAC-dlls as it would, had they been deployed to /bin.
However, for a production system this is a bit drastic (as it will cause all users to experience the dreaded "Service Unavailable" while IIS restarts), so I have been looking for alternatives.
It turns out that in order to reload a GAC-dll, all that is needed is to force an application pool recycle for the application pool Sharepoint is running within (default is MSSharePointPortalAppPool).
This can be accomplished using the MMC, or by running the following script (useful for webpart installers).
Option Explicit
'*** spsapppoolrecycle.vbs
'*** Script to recycle Sharepoint Portal Server application pool
'*** For use when deploying updated version of Webparts in the GAC
'*** Author: Michael Christensen, mac@landscentret.dk
'*** Provided AS IS with no warranties
'*** Heavily based on this posting by David Wang:
'*** http://tinyurl.com/4k26n
Const WEBSITEID = 1
Dim objApp
Dim AppPoolId
Dim objAppPool
Set objApp = GetObject("IIS://localhost/w3svc/" & WEBSITEID & "/root")
AppPoolId = objApp.AppPoolId
WScript.Echo "AppPoolID: " & AppPoolId
Set objAppPool = GetObject( "IIS://localhost/w3svc/AppPools/" + AppPoolId )
objAppPool.Recycle()
WScript.Echo "AppPool recycled."
The script assumes that Sharepoint is installed on the virtual server with ID 1. This will usually be the case, otherwise the actual ID could probably be determined programmatically.
(this is a repost of this posting, translated to English)
