0

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

2 Answers2

0

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

IdoFlatow
  • 1,440
  • 10
  • 8
0

Have you created a cross domain access policy to allow tcp communication?

<?xml version="1.0" encoding ="utf-8"?> 
 <access-policy>   
  <cross-domain-access>     
   <policy>       
   <allow-from>         
   <domain uri="*"/>       
   </allow-from>       
   <grant-to>         
   <socket-resource port="4502-4506" protocol="tcp" />       
   </grant-to>     
   </policy>   
</cross-domain-access> 
</access-policy>

Check out this article: http://www.silverlightshow.net/items/WCF-NET.TCP-Protocol-in-Silverlight-4.aspx

Nick Nieslanik
  • 4,388
  • 23
  • 21
  • I have done what the article says. But this article works without security. My problem begin when I tried to add security (windows authentication) – Omar Sosa Oct 10 '11 at 20:21
  • I'd bet that Silverlight 4 doest support secureconversation with sspinegotiated, though I haven't found documentation either way... Sorry I'm not more help. – Nick Nieslanik Oct 11 '11 at 04:02