【问题标题】:'The incoming message has an unexpected message format 'Raw'. The expected message formats for the operation are 'Xml', 'Json''传入的消息具有意外的消息格式'原始'。该操作的预期消息格式为“Xml”、“Json”
【发布时间】: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; }
}

【问题讨论】:

    标签: c# .net angularjs wcf api


    【解决方案1】:

    我的问题是由于无法访问所请求的资源引起的。该消息非常具有误导性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-10-09
      • 1970-01-01
      • 2014-11-25
      • 1970-01-01
      • 2017-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多