【发布时间】:2016-04-14 16:58:45
【问题描述】:
不知道我错过了什么,但出于某种原因,WCf 不断向我抛出此错误。
服务器在处理请求时遇到错误。异常消息是“传入消息具有意外消息格式“原始”。该操作的预期消息格式为“Xml”、“Json”。这可能是因为尚未在绑定上配置 WebContentTypeMapper。有关详细信息,请参阅 WebContentTypeMapper 的文档。有关更多详细信息,请参阅服务器日志。异常堆栈跟踪是:
在 System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.DispatchOperationRuntime。 DeserializeInputs(MessageRpc& rpc) 在 System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) 在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) 在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) 在 System。 ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
我的服务
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[UserAccessRoleValidatorAspect(Access = Otive.Subscriptions.UserAccessType.Install)]
public class PaymentProcessPublic : BaseService,IPaymentProcessPublic
{
private PaymentProcessorInvoiceService PaymentProcessorInvoiceService =
new PaymentProcessorInvoiceService(ConnectionManager.GetConnectionInfo(Otive.Consts.TenantId));
public GetQuickInvoiceInfoResponse GetInvoiceQuickInfo (GetQuickInvoiceInfoRequest Request)
{
GetQuickInvoiceInfoResponse Response = new GetQuickInvoiceInfoResponse();
Response.PaymentProcessorInvoiceInfo = this.Converter.Convert( PaymentProcessorInvoiceService.GetPaymentProcessorInvoiceInfo(Guid.Parse(Request.PaymentKey)));
return Response;
}
}
我的界面
[WebInvoke(RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
Method = "*", BodyStyle = WebMessageBodyStyle.Bare)]
[OperationContract]
GetQuickInvoiceInfoResponse GetInvoiceQuickInfo(GetQuickInvoiceInfoRequest Request);
请求标头 接受:application/json, text/plain, /
请求负载 {支付密钥:“A4F5E417-4938-4BA6-9E4C-FEC4C6499B28”}
服务器请求对象
public class GetQuickInvoiceInfoRequest
{
public string PaymentKey { get; set; }
}
【问题讨论】: