I'm trying to use binary message encoding in a WCF service, following the many examples on this site.
On the server I have the binding declared as so:
<customBinding>
<binding name="binaryHttpBinding">
<binaryMessageEncoding maxReadPoolSize="4096000" maxSessionSize="4096000" maxWritePoolSize="4096000">
<readerQuotas maxDepth="32" maxStringContentLength="4096000"
maxArrayLength="4096000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binaryMessageEncoding>
<httpTransport maxBufferPoolSize="4096000" maxBufferSize="4096000" maxReceivedMessageSize="4096000"/>
</binding>
</customBinding>
The service is set to use it (I think):
<service behaviorConfiguration="MyService.ServiceBehavior" name="MyService.ContentUploadService">
<endpoint
address=""
binding="customBinding"
bindingConfiguration="binaryHttpBinding"
contract="MyService.IContentUpload"
name="MyService.ContentUploadService" />
The client has the same declarations:
<customBinding>
<binding name="binaryHttpBinding">
<binaryMessageEncoding maxReadPoolSize="4096000" maxSessionSize="4096000" maxWritePoolSize="4096000">
<readerQuotas maxDepth="32" maxStringContentLength="4096000"
maxArrayLength="4096000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binaryMessageEncoding>
<httpTransport maxBufferPoolSize="4096000" maxBufferSize="4096000" maxReceivedMessageSize="4096000"/>
</binding>
</customBinding>
And:
<endpoint
address="http://foo.com/ContentUploadService.svc"
binding="customBinding"
bindingConfiguration="binaryHttpBinding"
contract="MyService.IContentUpload"
name="MyService.ContentUploadService"/>
The client appears to be working, but the server throws an exception that indicates that the binding is not in place:
Content Type application/soap+msbin1 was sent to a service expecting text/xml; charset=utf-8. The client and service bindings may be mismatched.
Immediately prior to this error in the log file is this one, thrown when trying to open the service host, which must be the cause.
Configuration evaluation context not found.
None of the search links I've tried for this message have been helpful. So, what basic piece am I missing?
Have you tried setting up a host on the server to compliment the endpoint?
I think it would be something like this:
<service behaviorConfiguration="MyService.ServiceBehavior" name="MyService.ContentUploadService">
<host>
<baseAddresses>
<add baseAddress="http://foo.com/ContentUploadService.svc"/>
</baseAddresses>
</host>
<endpoint address="" binding="customBinding" indingConfiguration="binaryHttpBinding" contract="MyService.IContentUpload" name="MyService.ContentUploadService" />
Hope this is helpful
It looks to me like your service is using the default configuration, which would happen if it cannot find an explicit configuration. Make sure the name attribute of the element exactly matches the fully qualified name of your service class (namespace included).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With