Friday, February 26, 2010

Migrating ClickOnce deployment to IIS7 and Fiddler Web Debugger

After migrating ClickOnce deployment to IIS7 I tried to install the application I got following exception:

System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
 - Downloading file_name_.extension did not succeed.

I have checked the log but still I could not figure out what exactly was wrong and my colleague suggested using the Fiddler (thanks Benny!) – great Web Debugging Proxy which logs all HTTP(S) traffic between your computer and the Internet. The Fiddler allows you to inspect all HTTP(S) traffic, set breakpoints, and "fiddle" with incoming or outgoing data. Fiddler includes a powerful event-based scripting subsystem, and can be extended using any .NET language.

Fiddler helped me found out that there were some missing MIME types configured on IIS 7. IIS uses a default list of global MIME types to determine which types of content to serve. If a client requests a MIME type that is not defined on the Web server, IIS returns a 404.3 error (according to MSDN). To fix this I had to add those missing MIME types in the IIS7 configuration.

After adding MIME types to the configuration I got again the same exception but this time a ".config" file could not be downloaded and again the Fiddler helped me figure out what was wrong. This time it was Request Filtering - IIS7 has really many types denied in request filtering by default. If your ClickOnce application contains .config file you have to allow this extension in request filtering feature.
After allowing the ".config" extension in request filtering feature in IIS7 the deployment started to work. Problem solved.

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

Thursday, February 11, 2010

SQL Server Management Tools installation problem and Windows Installer CleanUp Utility tool

Recently I had to install SQL Server 2005 with Management Tools, however setup complained about already installed Client Tools from SQL Server Express Edition. I tried to find the SQL Express Edition from Add/Remove Programs but it was not there! The Windows Installer CleanUp Utility (free tool!) came with help. After removing the Express Edition the SQL Server 2005 installed Management Tools without any problems.