这个错误说什么以及如何解决这个问题? [英] What this error saying and how to resolve this?

查看:49
本文介绍了这个错误说什么以及如何解决这个问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是WCF的新手并且收到此错误,请帮助我。这是错误





I am new to WCF and getting this error, please help me. this is the error


The operation ProcessPayment either has a parameter or a return type that is attributed with MessageContractAttribute.  In order to represent the request message using a Message Contract, the operation must have a single parameter attributed with MessageContractAttribute.  In order to represent the response message using a Message Contract, the operation's return value must be a type that is attributed with MessageContractAttribute and the operation may not have any out or ref parameters.





这是我的配置。





and here is my configurations.

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>

    <bindings>
      <basicHttpBinding>
        <binding name="SOAPBinding">
          <security mode="None"/>
        </binding>

      </basicHttpBinding>
      <webHttpBinding>
        <binding name="XMLBinding"/>
        <binding name="JSONBinding"/>
      </webHttpBinding>
    </bindings>

    <services>

      <service name="BillingApi.ProductPaymentProcessing" behaviorConfiguration="ServiceBehaviorConfig">
        <endpoint address="" binding="basicHttpBinding" contract="BillingApi.IProductPaymentProcessing" bindingConfiguration="SOAPBinding"  />
        <endpoint address="XML" binding="webHttpBinding" contract="BillingApi.IProductPaymentProcessing" behaviorConfiguration="XMLEndpointConfig" bindingConfiguration="XMLBinding"  />
        <endpoint address="JSON" binding="webHttpBinding" contract="BillingApi.IProductPaymentProcessing" behaviorConfiguration="JSONEndpointConfig" bindingConfiguration="JSONBinding"  />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>

      </service>
    </services>

    <behaviors>

      <endpointBehaviors>
        <behavior name="XMLEndpointConfig">
          <webHttp automaticFormatSelectionEnabled="false" helpEnabled="true"  defaultOutgoingResponseFormat="Xml"/>
        </behavior>

        <behavior name="JSONEndpointConfig">
          <!--<enableWebScript/>-->
          <webHttp automaticFormatSelectionEnabled="false" helpEnabled="true" defaultOutgoingResponseFormat="Json"/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>

        <behavior name="ServiceBehaviorConfig">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>

      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

    <!--<standardEndpoints>


    </standardEndpoints>-->

  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

推荐答案

这不是配置问题。该错误非常明显:ProcessPayment操作未正确声明。

它有多个参数,其中至少有一个被标记为MessageContract,或返回标记为MessageContract但具有<$ c的类型$ c> out 参数。



如果输入参数标记为MessageContract,则它必须是唯一的参数。

如果您返回MessageContract,则不能有任何out或ref参数。
This is not configuration problem. The error is pretty self-explanatory: ProcessPayment operation is not declared properly.
Either it has multiple parameters of which at least one is marked as MessageContract, or returns a type marked as MessageContract but has out parameter(s).

If you have input parameter marked as MessageContract it must be the only parameter.
If you return a MessageContract, you can''t have any out or ref parameters.


这篇关于这个错误说什么以及如何解决这个问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆