Retirado de Michael Christensen

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
 ‘*** Provided AS IS with no warranties
 ‘*** 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.”

LEAVE A REPLY

Please enter your comment!
Please enter your name here