1

尝试向 URI 发出请求时发生错误:

'http://localhost:8732/Design_Time_Addresses/WCF/Service1/'。这可能是由于试图

在没有适当的跨域策略的情况下以跨域方式访问服务,或者

不适合 SOAP 服务的策略。您可能需要联系服务的所有者

发布跨域策略文件并确保它允许与 SOAP 相关的 HTTP 标头

发送。此错误也可能是由于在 Web 服务代理中使用了内部类型而没有

使用 InternalsVisibleToAttribute 属性。请参阅内部异常了解更多信息

细节。

从 wcf 返回结果时出现错误

我通过控制台、网站、win 表单使用了这​​个 wcf,它工作正常

我在 WCF 库中使用 2 个 xml 文件:

  1. 客户端访问策略.xml
  2. 跨域.xml
4

2 回答 2

1

It used to make my brain hurt too.

I figured out for my use I needed this file:

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

named clientaccesspolicy.xml

The trick is that is has to be at the root of your web server. That being said you need to be able to browse the file. In your case located at:

http://localhost:8732/clientaccesspolicy.xml

If you cannot see the file silverlight will always complain and boy does it complain whenever it can!

I should point out that my policy file is not restrictive, so use it wisely.

于 2012-04-19T15:18:33.677 回答
0

哦,那个问题。除了跨域,您不能从 VS2010 运行调试器,这是我从该 localhost URL 收集的。尝试在您的 WCF 所在的域或服务器上发布 silverlight 应用程序。例如,如果您的 Web 服务在 http://10.xx.xx.xx/sites/myWCF 上,则在 http : //10.xx.xx.xx/sites/MySilverlightApp上发布您的 silverlight 应用程序。您的调试器将作为http://localhost:somePort运行,即使使用跨域策略文件也肯定会给您带来问题。除此之外,请确保您的 web.service 配置文件是正确的。确保所有接口都有端点绑定,并且主服务位置上有一个主机(听起来很明显,但这是一个常见错误)。

于 2012-04-22T12:26:12.400 回答