我已經編寫了一個非常簡單的WCF服務(託管在IIS中)和Web應用程序。如果他們都在同一個域中,它可以正常工作。但是,當我將它們放在不同的域(防火牆的不同側)時,Web應用程序會說:WCF和防火牆
由於身份驗證失敗,因此無法滿足安全令牌請求。說明:執行當前Web請求期間發生未處理的異常。請查看堆棧跟蹤以獲取有關該錯誤的更多信息以及源代碼的位置。 異常詳細信息:System.ServiceModel.FaultException:由於身份驗證失敗,無法滿足安全令牌請求。 源錯誤: 執行當前Web請求期間生成未處理的異常。關於異常的來源和位置的信息可以使用下面的異常堆棧跟蹤來標識。
服務的web.config的revelant部分是:
<system.serviceModel>
<services>
<service behaviorConfiguration="MigrationHelperBehavior"
name="MigrationHelper">
<endpoint address="" binding="wsHttpBinding" contract="IMigrationHelper">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <endpoint binding="httpBinding" contract="IMigrationHelper" /> </service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MigrationHelperBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
該網站appliation(客戶端)web.config中說:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IMigrationHelper" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<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" establishSecurityContext="true"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://mydomain.com/MigrationHelper.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMigrationHelper" contract="MyNewServiceReference.IMigrationHelper" name="WSHttpBinding_IMigrationHelper">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
</client>
</system.serviceModel>
相信無論這些只是默認的那個VS 2008爲我創造。
所以我的問題是,如何配置服務和客戶端,當他們不在同一個域?
感謝 .Jim Biddison