我是否處於Catch-22狀態?我的目標是採用我繼承的WCF服務,並在虛擬機上運行它,並通過從臺式PC中調用它進行測試。虛擬機在工作組中,而不在公司的域中。基本上,我們需要更多的測試環境,理想情況下每個開發者一個(我們可能有2到4個人需要這個)。因此,虛擬機的想法是,每個開發人員都可以擁有自己的Web服務器,這個服務器可以在一定程度上匹配或者真實環境(我們實際上有兩個網站,一個外部/暴露內部)。 [使用VS2010 .NET 4.0]試圖在非域虛擬機上運行WCF Web服務,安全錯誤
在內部服務,每種方法被裝飾與此屬性:
[OperationBehavior(Impersonation = ImpersonationOption.Required)]
我還在研究爲什麼這種需要。我認爲這是因爲webapp調用「內部」服務,並且a)我們需要用戶的憑據,或者b)我們可以執行一些PrinciplePermission.Demands來查看用戶是否在一個組中。我的興趣是創建一些ConsoleTest程序或UnitTest程序。
我改爲允許這樣的:
[OperationBehavior(Impersonation = ImpersonationOption.Allowed)]
,因爲我是在試圖在瀏覽器中查看.SVC收到此錯誤:
的承包經營「EditAccountFamily」要求Windows身份自動模擬。代表調用者的Windows身份不是通過綁定('WSHttpBinding','http://tempuri.org/')爲合同提供的('IAdminService','http://tempuri.org/'。
與原來的綁定這個樣子我沒有得到錯誤:
不過,我相信我需要關閉此安全性,因爲Web服務是不是在域
我傾向於在客戶端得到這些錯誤:
1)安全令牌的請求不能滿足,因爲身份驗證失敗 - 作爲「SecurityNegotiation未處理」的InnerException。
或
2)呼叫者不是由服務認證爲的「SecurityNegotiation是未處理的」一個的InnerException。
因此,我可以創建一些配置的代碼和web.config,這將允許每個開發人員在他自己的VM上工作嗎?還是必須將虛擬機加入域?
排列的數量似乎接近無窮。我已經開始創建一個Word.doc來說明如何處理每個錯誤,但是現在我處於被卡住的catch-22中。
感謝,
尼爾
服務器綁定:
<bindings>
<wsHttpBinding>
<binding
name="wsHttpEndpointBinding"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="500000000">
<readerQuotas
maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<!-- <security mode="None" /> This is one thing I tried -->
<security>
<message
clientCredentialType="Windows" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior
name="ABC.AdminService.AdminServiceBehavior">
<!-- 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="true" />
<serviceCredentials>
</serviceCredentials>
<!--<serviceAuthorization principalPermissionMode="UseAspNetRoles"
roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
<serviceAuthorization
principalPermissionMode="UseWindowsGroups"
impersonateCallerForAllOperations="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment
multipleSiteBindingsEnabled="true" />
客戶:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IAdminService" 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" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.159.132/EC_AdminService/AdminService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IAdminService"
contract="svcRef.IAdminService" name="WSHttpBinding_IAdminService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
更新12/27/2010: 即使這樣簡單的方法獲取SecurityNegotiation錯誤:
[OperationBehavior(Impersonation = ImpersonationOption.Allowed)]
public string TestHelloWorldOpen(string name)
{
return "Hello1 " + name;
}
請發佈您的客戶端和服務器綁定。 – 2010-12-22 22:39:30
@Greg:綁定張貼 – NealWalters 2010-12-22 23:56:05