Thursday, 19 September 2013

My WCF service is using the wrong binding

My WCF service is using the wrong binding

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

No comments:

Post a Comment