惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
D
DataBreaches.Net
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Check Point Blog
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
IT之家
IT之家
月光博客
月光博客
U
Unit 42
K
Kaspersky official blog
T
Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
云风的 BLOG
云风的 BLOG
酷 壳 – CoolShell
酷 壳 – CoolShell
I
InfoQ
Engineering at Meta
Engineering at Meta
Recorded Future
Recorded Future
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security @ Cisco Blogs
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
Security Archives - TechRepublic
Security Archives - TechRepublic
Webroot Blog
Webroot Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Schneier on Security
S
Secure Thoughts
The Register - Security
The Register - Security
B
Blog RSS Feed
The Last Watchdog
The Last Watchdog
P
Palo Alto Networks Blog
爱范儿
爱范儿
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
L
LINUX DO - 热门话题
C
Cisco Blogs
Spread Privacy
Spread Privacy
F
Full Disclosure
博客园 - 聂微东
T
The Blog of Author Tim Ferriss

博客园 - MonkChen

使用阿里云Java SDK 实现 DDNS Ehcache3.4 XML配置硬盘存储 Tesseract训练 Postgresql Jsonb字段内含数组属性的删除元素操作 Activiti开启SQL Log Drools mvel方言drl断点调试方法 Openfire 编译插件 mysql数据备份 Silverlight 缓存控制策略 Silverlight ComboBox with TreeView WCF CustomBinding 身份验证 CMF Android !No Launcher activity found错误 Android SDK Manager 无法获取列表的解决 Silverlight跨域调用gSoap/Java web service 以及wsdl文件的修改 gSOAP契约函数返回结构体(返回多个值) java jax-ws发布含有DateTime字段的实体的webservice gSoap中文乱码解决 RTMP协议
silverlight5 net.tcpBinding 跨域策略的解决
MonkChen · 2013-04-14 · via 博客园 - MonkChen

为了研究silverlight5的特性,下载了vs2012,测试Silverlight调用WCF,起初basicHttpBinding没问题,跨域解决了;试用net.tcp的时候还是遇到跨域的问题:

Could not connect to net.tcp://localhost:4502/Service1. The connection attempt lasted for a time span of 00:00:00.0550032. 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.

起初看到异常信息始终不得其解,后来google了N多资料也没有解决---很多谈的都是IIS Host,而我用的是Self-Host,后来逐字逐句看异消息,发现expose a sockets cross-domain policy over HTTP and host the service这句很有玄机,HTTP难道说的就是默认的80端口?尝试修改WCF的配置文件,将ICrossDomainService中的baseAddress端口设为80,加以辅助修改,测试成功!

ps:测试代码的背景

http://silverlightchina.net/html/tips/2010/1208/4010.html

注意:经测试发现ClientAccessPolicy.xml中grant-to一节写法对于不同的Binding有所区别:

basicHTTPBinding:

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
 <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
 </cross-domain-access> 
</access-policy>

net.tcpBinding

<?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" protocol="tcp" />
</grant-to> </policy> </cross-domain-access> </access-policy>


 源代码下载