2011-08-22 219 views
0

我真的很苦惱這個。我已經谷歌這一點,並嘗試了大部分解決方案沒有取得任何成功。WPF客戶端 - WCF允許跨域訪問 - 問題

一些背景資料:

我有一個WPF應用程序消耗WCF服務。如果服務和應用程序位於同一個域中,一切正常,但只要將應用程序移動到另一個域,它就會停止wokiring並提供以下錯誤:

安全令牌的請求無法滿足,因爲認證失敗。

我通過以下文章:跨域邊界提供服務[^],它涉及到使用某些XML文件,我曾嘗試將XML文件(clientaccesspolicy.xml和crossdomain。 xml)在IIS服務器上 - 這沒有任何區別(請注意,我確實將文件放在Web服務的根目錄中)?

我可以訪問Web服務(客戶端),通過在瀏覽器中輸入URL以及點擊wsdl鏈接並查看XML,但是我無法從我的WPF應用程序中使用它!

這是我的客戶端配置文件的內容:

<system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
      <binding name="WSHttpBinding_IManagmentService" closeTimeout="00:01:00" 
       openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
       bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
       maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" 
       messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
       allowCookies="false"> 
       <readerQuotas maxDepth="32" maxStringContentLength="2147483647" 
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
       <reliableSession ordered="true" inactivityTimeout="00:10:00" 
        enabled="false" /> 
       <security mode="Message"> 
        <transport clientCredentialType="Windows" proxyCredentialType="None" 
         realm="" /> 
        <message clientCredentialType="Windows" negotiateServiceCredential="true" 
         algorithmSuite="Default" /> 
       </security> 
      </binding> 
     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://server.local/ManagementDataProvider/ManagmentService.svc" 
      binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IManagmentService" 
      contract="ManagementService.IManagmentService" name="WSHttpBinding_IManagmentService"> 
      <identity> 
       <dns value="localhost" /> 
      </identity> 
     </endpoint> 
    </client> 
</system.serviceModel> 

任何人都可以請提供給我的我如何從我的應用程序訪問Web服務的一些信息。

非常感謝提前! 親切的問候,

+0

如果您通過瀏覽器調用服務,它是否提示您輸入用戶名/密碼?我假設託管服務的域名和託管客戶端的域名不存在信任關係,因此您的服務無法驗證客戶端。 – Dominik

+0

你可以發佈你的'clientaccesspolicy.xml'和'crossdomain.xml'的內容嗎? – Rachel

+0

而且這是否與一個普通的非安全綁定工作?一個沒有傳輸和消息安全性? (請參閱http://stackoverflow.com/q/394829/302677) – Rachel

回答