Silverlight 2.0 beta 1与crossdomain.xml和clientaccesspolicy.xml
里面提及了一个工具webdevhelper很不错,通过它可以看到一个silverlight应用运行的时候都做了哪些请求(当然,这个工具不只是干这个的).
如我的webservice目录叫做WSProject,引用地址是http://localhost/WSProject/webservice.asmx
那么silverlight不是在http://localhost/WSProject这个目录下找crossdomain.xml和clientaccesspolicy.xml
而是在http://localhost/下找这两个文件
所以假如你的IIS默认目录是C:/inetpub/wwwroot的话,服务文件是部署在C:/inetpub/wwwroot/WSProject下
那么crossdomain.xml和clientaccesspolicy.xml这样的文件一定要放在C:/inetpub/wwwroot
而不是http://localhost/WSProject.
方案二 salvation:
增加两个silverlight跨域专用文件
<system.serviceModel>
<behaviors>
<endpointBehaviors><!--跨域行为-->
<behavior name="DomainServiceBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="WcfService2.DomainService"><!--跨域服务帮助-->
<endpoint address=""
binding="webHttpBinding"
contract="WcfService2.IDomainService"
behaviorConfiguration="DomainServiceBehavior" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8082/"/> <!--你的服务主地址-->
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>