我的WCF服务不会使用我的wsHttpBinding

时间:2013-09-19 21:51:37

标签: vb.net wcf wcf-binding

我的web.config的

serviceModel部分:

<system.serviceModel>
  <bindings>
    <wsHttpBinding>
      <binding name="default" closeTimeout="00:01:00" openTimeout="00:01:00"
        receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
        bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
        maxBufferPoolSize="2147483647"  maxReceivedMessageSize="2147483647"
        textEncoding="utf-8"  useDefaultWebProxy="true"
        messageEncoding="Text">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" 
          maxArrayLength="2147483647"
          maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
      </binding>
    </wsHttpBinding>
  </bindings>
  <services>
    <service name="templateMgr">
      <endpoint address="http://edocengine.localtest.me/services/templateMgr.svc"
         name="templateMgr.svc" binding="wsHttpBinding" contract="ItemplateMgr"/>
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior>
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="false" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true"
     aspNetCompatibilityEnabled="true"/>
</system.serviceModel>

请注意,我在此处指定了wsHttpBinding,并指定了大MaxReceivedMessageSize。然而,当我在代码中断点时

? System.ServiceModel.OperationContext.Current.Host.Description.Endpoints(0).Binding.Name
"BasicHttpBinding"
? ctype(System.ServiceModel.OperationContext.Current.Host.Description.Endpoints(0).Binding,System.ServiceModel.BasicHttpBinding).MaxReceivedMessageSize
65536

是什么给出了?

编辑:这显然是服务器web.config。我的客户端使用旧式SOAP Web服务(wsdl.exe代理)而不是WCF服务引用(svcutil.exe)引用该服务。因此,客户端在其app.config中没有serviceModel部分。以下是客户端拨打电话时发送的标头:

POST http://edocengine.localtest.me/services/templateMgr.svc HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.18052)
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.edocbuilder.com/ItemplateMgr/setAssets"
Host: edocengine.localtest.me
Content-Length: 12192
Expect: 100-continue

编辑:找到了answer,修改了标题。

1 个答案:

答案 0 :(得分:2)

正如其他地方对SE的回答:

  

You cannot consume service exposed on wsHttpBinding with default configuration by old ASMX proxy.您必须使用添加服务   reference / svcutil或将绑定更改为basicHttpBinding。   wsHttpBinding的默认配置使用高级安全性和ASMX   不支持它。

所以,我想我需要回到basicHttpBinding并使其工作。