Ross Presser
Ross Presser

Reputation: 6255

My WCF service won't use my wsHttpBinding

serviceModel section of my web.config:

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

Note that I've specified wsHttpBinding here, and a large MaxReceivedMessageSize. Yet when I breakpoint in the code

? 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

What gives?

EDIT: This is obviously the server web.config. My client is referencing the service with an old fashioned SOAP web service (wsdl.exe proxy) rather than a WCF service reference (svcutil.exe). Therefore the client has no serviceModel section in its app.config. Here are the headers being sent when the client makes a call:

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

EDIT: found the answer, revised the title.

Upvotes: 0

Views: 627

Answers (1)

Ross Presser
Ross Presser

Reputation: 6255

As answered elsewhere on SE:

You cannot consume service exposed on wsHttpBinding with default configuration by old ASMX proxy. You must either use add service reference / svcutil or change your binding to basicHttpBinding. Default configuration of wsHttpBinding uses advanced security and ASMX doesn't support it.

So, I guess I need to go back to basicHttpBinding and make that work.

Upvotes: 2

Related Questions