Thursday 15 November 2007

Redeploying callouts by recycling the application pool, rather than IISRESET

When redeploying a callout on CRM 3.0, it is considered necessary to run IISRESET to unload the callout assembly from memory, and hence allow you to copy a new version of the dll. This can have several issues:
  1. After an IISRESET, it takes long enough to reload / rerender CRM data to be annoying when frequently testing and redeploying versions of a callout assembly
  2. If other users are using CRM, there will be an outage during the IISRESET
  3. IISRESET affects all other web applications on the server

To minimise the impact of 1) above, Michael Höhne's local debugging mechanism is an excellent solution in a lot of environments.

However, there are still the occasions when the callout has to be redeployed on to the CRM server. There's not much that can be about 2), although the following suggestion helps a bit.

We can do something about 3). A callout is loaded into the process for the CRM application pool (CrmAppPool), and it is only this application pool that needs to be recycled, rather than the whole of IIS. An application pool can be recycled via the IIS management console, but there is an easy way to script this, as follows:

  1. Open a command prompt
  2. Change directory to %Windir%\system32
  3. Run the following command:

cscript iisapp.vbs /a CrmAppPool /r

This will just recycle the application pool, after which you can copy the new callout assembly

1 comments:

André Lage said...

Dont now that method, i use this, works fine:

You can use Visual Studio 2005 to create callout, but you will need to have installed the framework 1.1.


Now in then Prebuild and Postbuild og the project you can put this lines, this line will only refesh the IIS faster, and you dont have to stop services and restart, fast and easy....

Prebuild

cscript C:\Inetpub\AdminScripts\adsutil.vbs stop_server W3svc/AppPools/CRMAppPool

cscript C:\Inetpub\AdminScripts\adsutil.vbs start_server W3svc/AppPools/CRMAppPool

Postbuild

xcopy "$(TargetPath)" "C:\Program Files\Microsoft CRM\Server\bin\assembly" /y