如果有人能把我从 跨域政策地狱里救出来的话 一定会很爽的
我有一个双倍的 WCF 服务, 使用 < code> netTcpBining , 客户是 Silverlight 4 应用程序。 当我自己主机服务时, 它会完美运作, 我的 Silverlight 客户可以毫无问题地消费服务。 然而, 当我在 IS 7 中主机时, 问题开始发生时。 当我主机是 IS 时, 我能看到服务在 :
http://localhost/conference/Video meetingService.svc
http://localhost/conference/ meeting/Video meetingservice.svc
< > http://locloclochost/conformus/会议/Videoconferences.svc
当我加上一个以IIS为主的服务, 并试着把它称为服务时, 我得到一个:
CommunicationException: Could not connect to net.tcp://localhost/Conference/VideoConferenceService.svc. The connection attempt lasted for a time span of 00:00:03.3071892. TCP error code 10013: An attempt was made to access a socket in a way forbidden by its access permissions.. 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.
或者,如果看到实际错误有助于激励那些以前见过的人,这就是它在Reference.cs
中向我扔的东西:
""https://i.sstatic.net/4rh0.png" alt="此处输入图像描述"/"
I have checked out almost every solution suggested regarding solving the cross-domain policy error, and I ve put my clientaccesspolicy.xml
in my default website root in IIS, and also in wwwroot
. I ve also turned off all my firewalls. I m able to see the policy at http://localhost/clientaccesspolicy.xml
and also at http://127.0.0.1/clientaccesspolicy.xml
but I still get this error.
以下是我的网络。 IIS 7: 的服务配置 :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<gcServer enabled="true" />
</runtime>
<system.web>
<compilation debug="false" />
</system.web>
<system.serviceModel>
<services>
<service name="VideoServer.VideoConferenceService">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IVideoConferenceService" contract="VideoServer.IVideoConferenceService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:4502/VideoServer/" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IVideoConferenceService" portSharingEnabled="true" transactionFlow="false" transferMode="Buffered" listenBacklog="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="2147483647" maxReceivedMessageSize="2147483647" closeTimeout="24.20:31:23.6470000" openTimeout="24.20:31:23.6470000" receiveTimeout="24.20:31:23.6470000" sendTimeout="24.20:31:23.6470000">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession enabled="false" />
<security mode="None">
<message clientCredentialType="None" />
<transport protectionLevel="None" clientCredentialType="None" />
</security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="False" />
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
这是银灯客户端 SServiceReferences.ClientConfig
文件:
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="NetTcpBinding_IVideoConferenceService">
<binaryMessageEncoding />
<tcpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost/Conference/VideoConferenceService.svc"
binding="customBinding" bindingConfiguration="NetTcpBinding_IVideoConferenceService"
contract="ServiceReference1.IVideoConferenceService" name="NetTcpBinding_IVideoConferenceService" />
</client>
</system.serviceModel>
</configuration>
Has anybody got any suggestions? This annoying error has taken days of my time thus far. Any help would be greatly appreciated.
<强 > EDIT 强 >
当我用小提琴手查看在网上会话中检索的文件时, 它显示我的浏览器正在检索客户访问政策文件, 所以我认为错误在别处, WCF 正在向我丢出这个错误。 我还设置了 IE9 来清除它每次关闭的缓存。 请看下面 。
""https://i.sstatic.net/GYKMU.png" alt="此处输入图像描述"/ >