配置自定义绑定(如带有 Windows 身份验证的 tcp 绑定)在 silverlight4 中不起作用
我有以下带有 TCP 绑定和 Windows 身份验证的服务器配置文件:
<customBinding>
<binding name="NewBindingTcpSecure">
<security authenticationMode="SecureConversation">
<secureConversationBootstrap authenticationMode="SspiNegotiated" />
</security>
<binaryMessageEncoding maxSessionSize="1000000">
<readerQuotas maxDepth="64" maxStringContentLength="131072" maxArrayLength="16384"
maxBytesPerRead="16384" maxNameTableCharCount="16384" />
</binaryMessageEncoding>
<!--<windowsStreamSecurity protectionLevel="None" />-->
<tcpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"
portSharingEnabled="true" />
</binding>
当我使用 Windows 应用程序进行消费时,它可以工作。 但当我使用 silverlight 4 进行消费时,它不起作用。
我在 silverlight 中的客户端绑定如下:
<bindings>
<customBinding>
<binding name="DefaultTcp">
<binaryMessageEncoding />
<tcpTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:4502/HelloWcf/Service1.svc"
binding="customBinding" bindingConfiguration="DefaultTcp"
contract="ServiceReference1.IService1" name="DefaultTcp" />
</client>
我收到的错误是:
The message could not be processed. This is most likely because the action 'http://tempuri.org/IService1/GetData' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.
请您的帮助...
I have the following server config file with tcp binding and windows authentication:
<customBinding>
<binding name="NewBindingTcpSecure">
<security authenticationMode="SecureConversation">
<secureConversationBootstrap authenticationMode="SspiNegotiated" />
</security>
<binaryMessageEncoding maxSessionSize="1000000">
<readerQuotas maxDepth="64" maxStringContentLength="131072" maxArrayLength="16384"
maxBytesPerRead="16384" maxNameTableCharCount="16384" />
</binaryMessageEncoding>
<!--<windowsStreamSecurity protectionLevel="None" />-->
<tcpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"
portSharingEnabled="true" />
</binding>
It works when I consume using a windows application.
But it doesn´t work when I consume using silverlight 4.
My client binding in silverlight is the following:
<bindings>
<customBinding>
<binding name="DefaultTcp">
<binaryMessageEncoding />
<tcpTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:4502/HelloWcf/Service1.svc"
binding="customBinding" bindingConfiguration="DefaultTcp"
contract="ServiceReference1.IService1" name="DefaultTcp" />
</client>
The error that I receive is:
The message could not be processed. This is most likely because the action 'http://tempuri.org/IService1/GetData' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.
Please your help...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否创建了跨域访问策略以允许 tcp 通信?
看看这篇文章:
http://www.silverlightshow.net/items /WCF-NET.TCP-Protocol-in-Silverlight-4.aspx
Have you created a cross domain access policy to allow tcp communication?
Check out this article:
http://www.silverlightshow.net/items/WCF-NET.TCP-Protocol-in-Silverlight-4.aspx
我知道这个线程有点旧,但以防万一有人检查它,有一个答案是值得的 - Silverlight 不支持安全的 TCP 绑定,如此处记录:
http://msdn.microsoft.com/en-我们/library/cc645026(v=vs.95).aspx
I know this thread is a bit old, but just in case someone checks it out, it's worth having an answer - Silverlight doesn't support TCP bindings with security, as documented here:
http://msdn.microsoft.com/en-us/library/cc645026(v=vs.95).aspx