Showing posts with label IIS. Show all posts
Showing posts with label IIS. Show all posts

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

Sunday, January 24, 2010

Setting up playground bug tracking system (Bugzilla on Win7 and IIS 7)

I have decided to improve my coding playground by setting up bug tracking system. I took a look at some open source tools and decided to install Bugzilla (http://www.bugzilla.org) which is widely used in many organizations and projects. I use Windows 7 and instead of recommended Apache server I used IIS 7.

Information on how to set up Bugzilla on windows environment can be found here: https://wiki.mozilla.org/Bugzilla:Win32Install
Most of the installation steps are quite straightforward; anyway it takes a lot of time to install and configure all the required components.

NOTE: if you plan to use smtp.gmail.com as SMTP do not install Perlx64 but Perlx86 (I could not install the required Email-Send-Gmail perl package)

There were a couple of issues during installation… The default installation of IIS 7 on Windows 7 is missing some required modules like ISAPI extensions etc. Click here for instructions how to do it.

Adding Script Modules on IIS 7 is quite different then on previous versions of IIS which goes like this: Select the virtual directory in the IIS (e.g. Bugzilla), then open feature Handler Mappings then 'Add Script Map' from context menu. Two Script Maps has to be added – for Perl and for CGI; for both choose Execute in Edit Feature Permissions.

For Perl type as follows (providing correct path)
Request path: *.pl
Executable: c:\Perl\bin\perl.exe "%s" %s
Name: Perl Script Map
Press 'OK'
Say 'YES' to ISAPI message

And the CGI:
Request path: *.cgi
Executable: c:\Perl\bin\perl.exe -xc:\bugzilla -wT "%s" %s
Name: CGI Script Map
Press 'OK'
Say 'YES' to ISAPI message

After running "checksetup.pl" from <BugzillaFolderPath> I got notifications about some missing required Modules so I had to execute following commands and again run checksetup.pl

ppm install DateTime
ppm install DateTime-TimeZone
ppm install Template-Toolkit
ppm install Email-Send
ppm install Email-MIME
ppm install Email-MIME-Encodings
ppm install Email-MIME-Modifier

Now, after executing 'checksetup.pl' the localconfig file was created and has to be updated with correct mySQL db_pass and db_port information

Since Bugzilla requires an SMTP to function on Windows another problem occurred because SMTP/POP service is not included in Win 7 J I have used smtp.gmail.com since I have an account there… however it does not work!

Gmail uses TSL protocol and to make it work some hack is required as described here.

After providing the necessary information you should be able to access http://localhost/Bugzilla or whatever name you have chosen for the virtual directory in IIS.