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


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

2 Answers 2


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

  <httpErrors errorMode=”Detailed” />

Something like this blog here: http://blogs.iis.net/bills/archive/2008/03/25/how-to-add-mime-types-with-iis7-web-config.aspx may shed light on what you need to do.

Mainly its update the static content settings in your applications web.config so that IIS7.5 knows about your own mime type.

  • Isn't this only for serving static content? I want to POST binary content into my asp.net application.
    – m__
    Jul 6, 2011 at 9:32
  • I've tried it but it doesn't seem to work either.
    – m__
    Jul 6, 2011 at 9:37
  • Tired brain, I miss read your question the first time. Why do you need to differenciate your mime type coming in?
    – ITHedgeHog
    Jul 6, 2011 at 9:42
  • I'm using it to distinguish which packets are valid and which aren't in my asp.net code.
    – m__
    Jul 6, 2011 at 9:44
  • I'm not understanding the why you would need to do that, surely if the binary data doesn't match what is expected your site should just return an error to the user? Or are you handling multiple mime types here?
    – ITHedgeHog
    Jul 6, 2011 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.