Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot activate binary http binding on server

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?

like image 641
David Avatar asked May 15 '11 19:05

David


2 Answers

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

like image 146
Brian Dishaw Avatar answered Oct 21 '22 08:10

Brian Dishaw


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

like image 41
David Nelson Avatar answered Oct 21 '22 09:10

David Nelson