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

时间:2015-11-12 09:20:48

标签: javascript c# asp.net web-services wcf

我在ASP网站上运行了简单的WCF服务。我决定创建页面并使用JavaScript进行调用。根据{{​​3}}我需要创建生成代理类的服务。我更改了web.config:

之前的网络配置:

                       

<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>

web.config之后:

<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>

现在WCF测试客户端实用程序显示错误:

Error: Cannot obtain Metadata from http://localhost:35168/fmNVB.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.

如果我通过输入加法器description I found使用浏览器访问网站我有错误:

Operation 'GetErrorByCode' in contract 'IFmNVBDevice' specifies an 'out' or 'ref' parameter. Operations with 'out' or 'ref' parameters are not supported.

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

0 个答案:

没有答案