Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question

2 Answers 2

up vote 1 down vote accepted

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

I added the following code to my web.config

<system.webServer>
  <httpErrors errorMode=”Detailed” />
</system.webserver>
share|improve this answer

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.

share|improve this answer
    
Isn't this only for serving static content? I want to POST binary content into my asp.net application. –  m__ Jul 6 '11 at 9:32
    
I've tried it but it doesn't seem to work either. –  m__ Jul 6 '11 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 '11 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 '11 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 '11 at 9:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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