'传入的消息具有意外的消息格式“Raw”。该操作的预期消息格式为“Xml”、“Json”

问题描述 投票:0回答:1

不知道我错过了什么,但由于某种原因 WCf 不断向我抛出这个错误。

The server encountered an error processing the request. The exception message is 'The incoming message has an unexpected message format 'Raw'. The expected message formats for the operation are 'Xml', 'Json'. This can be because a WebContentTypeMapper has not been configured on the binding. See the documentation of WebContentTypeMapper for more details.'. See server logs for more details. The exception stack trace is:

at 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) at
 
System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at

 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at
 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at 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
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.