System.Net.Http.UnsupportedMediaTypeException fiddler 在 运行 Web API post 请求中出现异常

System.Net.Http.UnsupportedMediaTypeException exception occur in fiddler on running Web API post request in fiddler

我是 ASP.NET MVC web api 的新手。我正在尝试 运行 由 visual studio 2013 创建的默认 web api 项目。另外,我正在使用 fiddler 来测试 web api。

在该默认项目中,创建了一个 post 方法 'api/Account/Register'。当我尝试 运行 这在 fiddler UnsupportedMediaTypeException 发生。我搜索了很多并尝试添加内容类型 content-type: application/json; header 在提琴手的作曲家部分。但异常仍然发生。以下是完整的异常详细信息 -

{"Message":"The request contains an entity body but no Content-Type header. The inferred media type 'application/octet-stream' is not supported for this resource.","ExceptionMessage":"No MediaTypeFormatter is available to read an object of type 'RegisterBindingModel' from content with media type 'application/octet-stream'.","ExceptionType":"System.Net.Http.UnsupportedMediaTypeException","StackTrace":" 在System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent 内容,Type 类型,IEnumerable1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpContentExtensions.ReadAsAsync(HttpContent content, Type type, IEnumerable1 格式化程序,IFormatterLogger formatterLogger,CancellationToken cancellationToken)\r\n at System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage 请求,Type 类型,IEnumerable` 1 个格式化程序,IFormatterLogger formatterLogger,CancellationToken cancellationToken)"}

这是我在 fiddler 中的设置 -

请让我知道我缺少什么。

尝试插入接受header:

Accept: */*

意思是:给你所拥有的...

Accept: application/json

意思:给我JSON