IIS: Request with unknown content-type denied

iisiis-7iis-7.5mime-type

I have an IIS7.5 box running an asp.net mvc 3 application. The application receives binary POST requests and returns a binary answer. To distinguish this binary data from all other packets I setup my own mime-type (let's call it application/my.binary.data) that I use together with the Content-Type header.

The IIS-server does not seem to like my own mime-type and rejects the packet with a 400 Bad Request. If I change the mime-type to application/octet-stream it gets through IIS and I get an answer from my application.

How do I set IIS to allow my own mime-type for requests?

Request packet

POST http://my.local.domain/Page  HTTP/1.1
Host: my.local.domain
Content-Length: 33
Content-Type: application/my.binary.data
Cache-Control: no-cache

..............p.00000000000000...

Response packet:

HTTP/1.1 400 Bad Request
Cache-Control: private
Content-Type: text/html
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 3.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 06 Jul 2011 08:11:27 GMT
Content-Length: 11

Bad Request

Best Answer

I was finally able to fix the problem by following the following guide at http://www.donnfelker.com/aspnet-mvc-iis7-and-bad-request/.

I added the following code to my web.config

<system.webServer>
  <httpErrors errorMode=”Detailed” />
</system.webserver>