Compartilhar via


Default Content Type

Why doesn't WCF recognize a request without a Content-Type header?

An HTTP message that contains a body is supposed to include a Content-Type header that describes the body format. An indication of the body format is crucial to processing the message because the message might mean very different things depending on what the body tells the recipient. If the Content-Type header is not included, then the recipient is allowed to guess what the body format was supposed to be. Guessing is typically practiced by applications that just display the message, such as web browsers, where the consequences of guessing wrong aren't too bad. If the recipient isn't able to guess the body format, then they're allowed to apply a default format to the messages that remain unknown.

WCF won't try to guess what you meant to send it and doesn't process messages without a Content-Type header. In 4.0 we still won't try to guess what you mean, but we will at least give your message a default body format of application/octet-stream if you don't specify one.