WCF元数据读取异常

时间:2018-07-11 11:00:15

标签: c# .net wcf soap

我有这样配置的WCF服务:

<bindings>
  <basicHttpBinding>
    <binding allowCookies="true" receiveTimeout="00:20:00" sendTimeout="00:25:00" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
      <readerQuotas maxDepth="32" maxArrayLength="2147483647" maxStringContentLength="2147483647" />
    </binding>
  </basicHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<protocolMapping>
  <add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

我正在尝试实现一个没有合同和服务名称的客户端来按名称调用方法,到目前为止,我正在尝试使用如下代码下载元数据:

var binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
binding.MaxReceivedMessageSize = Int32.MaxValue;

// Set some quotas for the binding.
var readerQuotas = new XmlDictionaryReaderQuotas();
readerQuotas.MaxNameTableCharCount = Int32.MaxValue;
binding.ReaderQuotas = readerQuotas;

var mexClient = new MetadataExchangeClient(binding);
var metaSet = mexClient.GetMetadata(new EndpointAddress(wsdl));

问题在于无论使用什么url:

什么都不起作用,前两个URL引发错误,指出The message with Action 'http://schemas.xmlsoap.org/ws/2004/09/transfer/Get' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher,第三个URL引发错误,代码405。WCF服务正常工作,并且使用Visual Studio随附的WCF测试客户端,我可以轻松访问它第二个网址。

0 个答案:

没有答案