Javascript WCF测试实用程序无法获取元数据,为什么不支持ref

Javascript WCF测试实用程序无法获取元数据,为什么不支持ref,javascript,c#,asp.net,web-services,wcf,Javascript,C#,Asp.net,Web Services,Wcf,我在ASP网站上运行了简单的WCF服务。我决定创建页面并从JavaScript调用。根据这一点,我需要创建生成代理类的服务。我已更改web.config: 之前的web配置: <configuration> <system.web> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" />

我在ASP网站上运行了简单的WCF服务。我决定创建页面并从JavaScript调用。根据这一点,我需要创建生成代理类的服务。我已更改web.config:

之前的web配置:

<configuration>
    <system.web>
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
    </system.web>

    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
              <behavior name="">
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
            multipleSiteBindingsEnabled="true" />

      <services>
        <service name="fmNVBwebSrv.fmNVBDevice">
       </service>
      </services>      


    </system.serviceModel>
</configuration>

这实际上是正确的,因为GetErrorByCode的参数包含ref。但为什么不允许使用它,以及如何解决WCF测试实用程序的问题?

在操作中不能使用ref和out参数。您希望HTTP服务如何使用ref接收内容?想象一下:我希望服务使用ref向调用者返回一些东西。我无法想象,因为我是web服务的新手,但从远程函数调用的角度来看,这看起来很正常。这是否意味着我不能在任何类型的web服务中使用ref?但为什么web.config的第一个版本允许使用WCF测试实用程序调用函数呢?web服务位于另一个上下文中。它对调用方上下文中的任何变量一无所知。因此,当客户端调用WCF方法时,它实际上序列化了一条消息SOAP、XML、JSON等,并通过HTTP发送它。然后,服务器返回序列化的消息,客户端将其反序列化。粗略地说,它是按值传递的。无法将对客户端上下文中变量的引用传递给服务器,但我希望JavaSript能够像WCF实用程序一样工作。WCF测试实用程序很高兴我的web服务接口函数具有ref参数。
<configuration>
    <system.web>
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
    </system.web>

    <system.serviceModel>
        <behaviors>
          <endpointBehaviors>
            <behavior name="fmNVBwebSrv.WCFJSproxyBehavior">
              <enableWebScript/>
            </behavior>
          </endpointBehaviors>

            <serviceBehaviors>
              <behavior name="MEX">
                <serviceMetadata/>
              </behavior>

              <behavior name="">
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
            multipleSiteBindingsEnabled="true" />

      <services>
        <service name="fmNVBwebSrv.fmNVBDevice">
          <endpoint address="" behaviorConfiguration="fmNVBwebSrv.WCFJSproxyBehavior"
                    binding="webHttpBinding" contract="fmNVBwebSrv.IFmNVBDevice">
          </endpoint>
        </service>

        <service name="MyService" behaviorConfiguration="MEX">
          <endpoint
              address="http://localhost:8200/MEX"
              binding="mexHttpBinding"
              contract="IMetadataExchange"/>
        </service>


      </services>      


    </system.serviceModel>
</configuration>
Operation 'GetErrorByCode' in contract 'IFmNVBDevice' specifies an 'out' or 'ref' parameter. Operations with 'out' or 'ref' parameters are not supported.