That's because we process the request body inside the action, without invoking a media-type formatter. And I believe you can only post one element at a time, so you shouldn't have an array in the request JSON either. 第一步:先确定Unsupported Media Type是什么意思不支持的媒体类型(Unsupported media type)简单说就是你传输的json和后台接收到的匹配不上,类型不匹配那么问题... 博文 来自: z944395433的博客 What is on Mozilla's site on how to set 'Content-Type' header to … In HTTP, media types describe the format of the message body. To fix the unsupported media type I had to use HttpRequestMessage and add header to accept json with MediaTypeWithQualityHeaderValue like bellow. thanks for your help so far. type UnsupportedMediaTypeResult = class inherit StatusCodeResult Public Class UnsupportedMediaTypeResult Inherits StatusCodeResult Inheritance If it's meant to be a value from query, you need to add a FromQuery on the action parameter. IsSubsetOf(MediaType… When posting raw body content to ASP.NET Core the process is not very self-explanatory. by Mike Wasson. To demonstrate this, comment out the line that adds input formatter and try POST: Removing Formatters New here? This tutorial shows how to support additional media formats in ASP.NET Web API. Refer to this site for how to set Content-Type. Is GetModel a complex type?ApiController assumes complex types come from the body. GetEncoding(String) GetEncoding(StringSegment) GetParameter(String) Gets the parameter parameterName of the media type. 遇到几次使用Idhttp 进行接口请求的时候报错 http 415 unsupported media type 的错误。最后的解决办法几乎都是一样的。 设置Idhttp.ContentType 的类型。如 接口要求使用Post方式Json格式的串则设置: Idhttp.ContentType = 'application/json'. If not, the controller returns HTTP status code 415 (Unsupported Media Type). Yes, it is making progress :). 01/20/2014; 4 minutes to read +4; In this article. If a suitable input formatter is not setup, server will return 415 (Unsupported Media Type) response. ASP.NET Core表单POST导致HTTP 415 Unsupported Media Type响应怎么办? 内容来源于 Stack Overflow,并遵循 CC BY-SA 3.0 许可协议进行翻译与使用 回答 ( 2 ) Internet Media Types. When sending data to server, Content-Type header specifies the type of data in HTTP body. There's no easy way to simply retrieve raw data to a parameter in an API method, so a few extra steps are provided using either manual handling of the raw request stream, or by creating custom formatter that can handle common 'raw' content types in your APIs via standard Controller method parameters. The problem was with the headers. GET and DELETE should not require Content-Type I do not know if this is related to a similar core 2.2 bug dotnet/aspnetcore#4396 even though I am currently using core 2.1 The IsMultipartContent method checks whether the request contains a multipart MIME message. [HttpPost] public async Task Post([FromBody]string email) { } When calling from the postman, I had to call the above API as below with the header set as Content-Type = application/json SoapUI w/ASP.NET and "415 Unsupported Media Type" Hi All, I'm trying to connect to a site that's running a ASP.NET server using SoapUI and no matter what I try, the only response I get back is: I have ASP.Net Core 2.1 API.It looks as below. In JSON Verbose request payloads there should not be a "d" outer element. Make a GET HTTP call to Controller without Content-Type headder; 415 Unsupported Media Type is returned; Downgrade to 3.0 and the above steps return 200. Join a community of over 2.6m developers to have your questions answered on 415 Unsupported Media type on REST .net Core of Reporting Reporting.