Configure IIS-Hosted WCF to Run On SSL

It’s possible to run IIS-hosted WCF locally, with SSL.

Here’s the full guide: Configure an IIS-hosted WCF service with SSL.

To generate self-signed trusted SSL certificate, see How to Create Valid and Trusted SSL Certificate (Wildcard) for Development.

Just in case you need it, for web application to run on IIS Express with SSL, see: Enable SSL in IIS Express

Configure Site to Run Kickstrap and Less in IIS

As I already stated previously that LESS will not run locally when you click on your HTML file, I will show you how to configure a site in IIS 8 that will load Kickstrap pages which contains LESS.

This post assume you have created a new site. And also, I am running IIS 8.

Basically, it’s very simple to run Kickstrap and LESS in IIS. All we need to do is add new MIME type for .less and .ks

Go to IIS and select the Web Site you want to configure. Double click on MIME Types under IIS section.

On the right side menu, Actions, click Add.

On Add MIME type window, type in following information and click OK:

File name extension: .less
MIME type: text/css

Do the same thing for Kickstrap configuration file:

File name extension: .ks
MIME type: text/plain

Host WCF in IIS with Windows 8

For some people, like me, running the real IIS (not IIS Express) is preferably. When you host WCF in IIS under Windows 8 platform, like me, you can run into several problems. This is mine:

In Windows 8, I can’t use ServiceModel Registration Tool and it points me “Turn Windows feature on or off” which is under Control Panel setting.

Once in Windows Features window, make sure the highlighted item is check to be installed.

WCF Exception in IIS Only (“The underlying provider failed on Open”) – Access to Entity Framework

What if you try to run your WCF Service in IIS and get the following error although you have already done this post?

The underlying provider failed on Open.

For my case, it only happens when deploying to IIS 7.5. Everything runs perfectly fine in local (under Visual Studio 2008). This is .Net framework 3.5. The WCF Service is accessing Entity Framework on back end.

Well, check on the firewall rules. The following ports are being dropped:

MSSQL Monitor (Revolver) – Port 1434 (UDP)
Microsoft-DS Active Directory – Port 445 (TCP)

These ports need to be in white-list for Entity Framework communication between source (web server) and destination (database server).

Debug and Trace WCF Exception Message

This is WCF run on IIS 7.5. When runs on Visual Studio (locally), everything looks good. But when deploying in IIS, it shows the below message:

How frustrating are as a developer when you see below error message?

To enable debug / tracing in WCF and display the exception message, change “includeExceptionDetailInFaults” attribute of “serviceDebug” tag in the config file to true.

            <behavior name="DefaultServiceBehavior">
                <serviceMetadata httpGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="true" />

Better, huh?

Internet Explorer Display Detail Error Message (for Configuring WCF)

I was never a fan of Internet Explorer (IE), to me the browser just slow.

However, I do finally find a good use of IE browser… it’s to display more detail error message.

This is particularly deals with WCF configuration in IIS 7.5. While configuring my WCF service to run in IIS, I encounter the following error message using Firefox 3.6:

While Firefox’s error message doesn’t tell me anything I could use to troubleshoot the issue, this is what IE gives me:

Also, notice how IE gives me “500.19” instead of just “500”. Here’s the detail and explanation of each HTTP status code in IIS 7.0 from MSDN site:

Specify an Identity for an Application Pool in IIS 7.0 (under Windows Server 2008)

Sometime, you will need to change Application Pool’s identity to run under different credential.

One case example is to allow Application Pool to access database under credential that has special privilege.

Here’s how you do it: pull up your IIS 7.0 > select “Application Pools” menu on the left > select the name of the Application Pool you want to modify > click “Advanced Settings” on the right menu.

The default Identity is “ApplicationPoolIdentity”.

When you click on the ellipsis of the Identity parameter, here’s what you will see: