开发者

Cannot activate binary http binding on server

开发者 https://www.devze.com 2023-03-05 21:26 出处:网络
I\'m trying to use binary message encoding in a WCF service, following the many examples on this site.

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"
            maxArrayLe开发者_如何学Pythonngth="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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号