WCF和Silverlight的crossdomain.xml [英] WCF and Silverlight CrossDomain.xml
问题描述
道歉,如果这已经被问过(我无法找到答案的任何地方),但我有我创建了一个WCF服务应用程序,并正尝试通过我的Silverlight 4应用程序来访问。我已经添加了服务引用Silverlight应用程序和我只是想调用的服务(的GetData)的默认pre现有的方法之一。当调用该方法,我得到了一个错误:
Apologies if this has been asked before (I couldn't find the answer anywhere), but I have a WCF Service Application that I have created, and am trying to access via my Silverlight 4 app. I have added the service reference to the SilverLight App and am just trying to call one of the default pre existing methods on the service (GetData). When calling the method i get an error of:
而努力使出错 请求URI我的URI这可能 是由于试图访问 在未经跨域方式服务 有了适当的跨域策略, 或政策文件,是不合适的 对SOAP服务。
An error occurred while trying to make a request to URI "my URI" This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy file that is unsuitable for SOAP Services.
我知道我需要一个crossdomain.xml文件,但它不似乎无论身在何处我把crossdomain.xml文件,我仍然得到错误,这是该文件的内容:
I'm aware I need a crossdomain.xml file, but it doesnt seem to matter where i place the crossdomain.xml file, i still get the error, this is the contents of the file:
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="http://*"/>
<domain uri="https://*" />
</allow-from>
<grant-to>
<resource include-subpaths="true" path="/"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
任何想法?
推荐答案
它确实身在何处,您将策略文件 - 它需要被放置在根这是运行服务的Web服务器
It does matter where you place the policy file - it needs to be placed "at the root" of the web server that's running your service.
这是pretty的有据可查了在 HTTP: //msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx
That's pretty well documented up at http://msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx
在这些问题上我最好的建议是运行Fiddler工具和跟踪流量,你应该看到的Silverlight寻找一个clientaccesspolicy.xml的文件(也是crossdomain.xml文件这是一种不同的格式),而且应使容易确定何处Silverlight的被查找的文件
My best advice on these issues is to run the Fiddler tool and trace the traffic and you should see Silverlight looking for a clientaccesspolicy.xml file (and also the crossdomain.xml file which is a different format) and that should make it easier to determine where Silverlight is looking for the file.
麦克。
这篇关于WCF和Silverlight的crossdomain.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!