Jaa


Refreshing assembly being loaded by IIS

Recently I have been working with a project that requires me to place an updated assembly in the GAC and ensure that IIS (Sharepoint) picks up the new assembly. I have been looking to do it programmitically and interestingly there are a number of alternatives:

1. Launch IISReset.exe /RESTART : However, this does not give me sufficient control and error-handling functioanlity in my program. Moreover, I think it might be an overkill to do IISReset to achieve an assembly refresh - since IISReset seems to be doing a lot more under the wraps.

2. Use the Service Control Manager APIs to restart the W3SVC in IIS: This sounds like a more optimal solution since I can just restart the W3SVC and not have to restart the whole of IIS which could potentially have other services (SMTP etc.). Check the APIs out here.

3. Recycle the Application Pool which consumes the assembly: To the best of my knowledge this is the most optimal solution because it hits the nail on the head - and does the least amount it is supposed to do ie. it only restarts the worker process which is consuming the assembly that needs to be refreshed. API to recycle app pools are here.

Comments