SL4+net.tcp通信问题

错误提示:

System.ServiceModel.CommunicationException: Could not connect to net.tcp://localhost:4503/AnalysisBLL.UserBLD. The connection attempt lasted for a time span of 00:00:00.0781250. TCP error code 10013: 试图以其访问权限所禁止的方式访问套接字。. This could be due to attempting to access a service in a cross-domain way while the service is not configured for cross-domain access. You may need to contact the owner of the service to expose a sockets cross-domain policy over HTTP and host the service in the allowed sockets port range 4502-4534. ---> System.Net.Sockets.SocketException: 试图以其访问权限所禁止的方式访问套接字。

 

 

 

策略文件:ClientAccessPolicy.xml

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

 

解决方法:

Silverlight 4正式版调用 net.tcp 的WCF,WCF端要在80端口提供 Socket策略文件 ,最简单的就是在 80端口的IIS上放置 ClientAccessPolicy.xml

你可能感兴趣的:(service,domain,silverlight,WCF,encoding,Sockets)