Error 404.17 The requested content appears to be script: Check the framework version on your App Pool

I got the above exception when wiring a BizTalk Receive Location to a WCF service today.   As usual, a cryptic error message that made little sense at first glance.. oh, brother…

Anyway, simple problem–simple solution:  the Application Pool we were running under was configured to use .NET 2.0, which is the default for new Application Pools in IIS 7.  Since our WCF service was using .NET 4 we needed the pool to run under that instead.  We changed the version, restarted the pool and Voila!, system works.

A helpful hint for anyone who gets this exception and hasn’t thought about checking framework version on their App Pool.  Of course, this isn’t the only thing that may cause a 404.17, but it’s an easy one to check for.


WCF: (400) Bad Request while Streaming Large Files through IIS

It’s always the little things.

Last week, one of my WCF services hit a snag as attempts were made to submit large files via streaming.  For more info on how to set up a WCF service to stream data, see How to: Enable Streaming on MSDN.

When we sent small files through the service, all worked fine.  However, larger files (about 4MB and higher) generated the very unhelpful http exception:  (400) Bad Request. This exception occurs because the entire message is not processed.

We looked at the typical culprits of this problem like <binding> settings such as maxReceivedMessageSize and <readerQuota> values to no avail. 

It turned out the real problem was not in WCF, but in IIS.  HTTP communication has a size limit that you have to override if you want to send large messages to your WCF service hosted in IIS.   In the config file (web.config), adjust the <httpRuntime>‘s maxRequestLength attribute to a large enough size to support your messages.  The value will be an integer representing the size in Kilobytes and has about a 2GB limit.  The setting looks something like this (I set mine to about 64MB):

    <httpRuntime maxRequestLength="65536" />

If IIS is the problem, you should now be able to process messages up to the size indicated in the maxRequestLength attribute. Good luck!

WCF and HTTP Error 404.3 – Not Found

In the web world, a 404 error is usually self-explanatory–whatever page you’re requesting simply isn’t there.

However, there are different variations of the 404 error. The 404.3 error is different from the typical 404 error in that the item you request may actually exist on the server. It’s just that the server can’t process it. One of the descriptions that you might get with this is

The page you are requesting cannot be served because of the extension of the configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

If you’re attempting to access a WCF service, the issue may be that the web server may not have WCF correctly installed and configured. To solve this problem, execute the Service Model Registration tool to enable WCF on IIS.  To do so, just run the following from a command line as an Administrator:

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

The following article provides a great step-by-step on how to setup a WCF service on IIS 7, including the above step to register WCF components:;_Windows_2008_-_The_right_way.aspx