2011-08-10 132 views
1

我们有WCF RIA服务域通过https客户端访问策略问题,在服务

[EnableClientAccess(RequiresSecureEndpoint = true)] 

一个WCF RIA领域的服务我们的网站设置为使用HTTP和HTTPS。我们在网站上这样的根客户端访问策略文件:

<access-policy> 
<cross-domain-access> 
<policy> 
    <allow-from http-request-headers="*"> 
    <domain uri="http://*"/> 
    <domain uri="https://*"/> 
    </allow-from> 
    <grant-to> 
    <resource include-subpaths="true" path="/"/> 
    </grant-to> 
</policy> 
</cross-domain-access> 
</access-policy> 

当我们访问通过https Silverlight应用程序,一切都很好。当我们通过http访问它时,我们得到以下错误:

Invoke operation 'Working' failed. An error occurred while trying to make a request to URI 'https://localhost/ClientBin/SilverlightApplication3-Web-DomainService1.svc/binary/Working'. 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 that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.

这意味着我们的策略文件不正确,但看不到什么。有任何想法吗?

回答

1

它不工作的原因是我们使用自签名证书,使用机器名称生成,然后在url上使用localhost。 url必须匹配以确保ssl没有证书错误。

检查此问题的好方法是通过https运行整个站点,并确保浏览器不会出现证书错误。