无法激活服务器上的二进制 http 绑定
我正在尝试按照本网站上的许多示例在 WCF 服务中使用二进制消息编码。
在服务器上,我将绑定声明如下:
<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>
服务设置为使用它(我认为):
<service behaviorConfiguration="MyService.ServiceBehavior" name="MyService.ContentUploadService">
<endpoint
address=""
binding="customBinding"
bindingConfiguration="binaryHttpBinding"
contract="MyService.IContentUpload"
name="MyService.ContentUploadService" />
客户端具有相同的声明:
<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>
并且:
<endpoint
address="http://foo.com/ContentUploadService.svc"
binding="customBinding"
bindingConfiguration="binaryHttpBinding"
contract="MyService.IContentUpload"
name="MyService.ContentUploadService"/>
客户端似乎正在工作,但服务器抛出一个异常,表明绑定未到位:
内容类型 application/soap+msbin1 被发送到期望的服务 文本/xml;字符集=utf-8。客户 和服务绑定可能是 不匹配。
日志文件中紧接此错误之前的是尝试打开服务主机时抛出的错误,这一定是原因。
配置评估上下文不 找到了。
我为此消息尝试过的搜索链接都没有帮助。那么,我缺少什么基本部分?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过在服务器上设置主机来补充端点?
我认为这会是这样的:
希望这有帮助
Have you tried setting up a host on the server to compliment the endpoint?
I think it would be something like this:
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).