Thursday, February 25, 2010

How to deploy service on IIS 7

Recently I had to deploy compiled services on IIS 7. When I tried to make the services work I have encountered a couple of problems, mostly caused by differences between IIS 6 and 7. IIS 7 seems to be totally different than version 6. Here is a short guide how to make services work.

  1. IIS 7 does not work with WCF by default - following command has to be executed from the command line

    "%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r –y

  2. Compared to IIS 6 services instead of being kept in virtual directories have to be created as an application. I have created virtual directories first and then converted them into applications
  3. Make sure that the service assemblies are in the bin folder under the virtual directory!
    If the assemblies are not in the bin folder the server will respond with following error:

    The type 'YourServiceName', provided as the Service attribute value in the ServiceHost directive could not be found
    If you see the above error, the most probable reason is that you don't keep the assemblies in the bin folder. It took a while before I have found this out
    J

  4. This is not necessary but can improve security - set permissions for IIS_USR and Network service (read & execute; list folder contents; read)

After applying above steps the service should work like a charm J

No comments: