2011-08-10 468 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運行整個站點,並確保瀏覽器不會出現證書錯誤。