use*_*123 5 fiddler asp.net-web-api postman
我正在使用Web API创建登录服务.当我与检查fiddler它的正常工作,但是当我与检查postman的chrome它的示值误差:
{ "Message": "An error has occurred.",
"ExceptionMessage": "No MediaTypeFormatter is available to read an object of type 'user' from content with media type 'multipart/form-data'.",
"ExceptionType": "System.InvalidOperationException",
"StackTrace": "
at System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger)\r\n
at System.Net.Http.HttpContentExtensions.ReadAsAsync(HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger)\r\n
at System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger)\r\n
at System.Web.Http.ModelBinding.FormatterParameterBinding.ExecuteBindingAsync(ModelMetadataProvider metadataProvider, HttpActionContext actionContext, CancellationToken cancellationToken)\r\n
at System.Web.Http.Controllers.HttpActionBinding.<>c__DisplayClass1.<ExecuteBindingAsync>b__0(HttpParameterBinding parameterBinder)\r\n
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()\r\n
at System.Threading.Tasks.TaskHelpers.IterateImpl(IEnumerator`1 enumerator, CancellationToken cancellationToken)"
}
Run Code Online (Sandbox Code Playgroud)
public class user
{
//public user(string userId, string password)
//{
// UserId = userId;
// Password = password;
//}
public string UserId { get; set; }
public string Password { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我正在检查postman此服务是否能够在移动应用程序中访问.另外,在mac系统中检查一下.
stp*_*evi 13
单击Header按钮,键入此标题和值
Content-Type: application/json
Run Code Online (Sandbox Code Playgroud)
检查以下链接的小提琴和邮差都使用相同的内容类型 错误将POST中的json发送到Web API服务
| 归档时间: |
|
| 查看次数: |
27778 次 |
| 最近记录: |