![](/img/trans.png)
[英]Enable both Windows authentication and Anonymous authentication in an ASP.NET Core app
[英]Enable both Basic and Windows authentication
我在IIS7上使用Windows身份驗證啟用了我的服務。
<binding name="Soap.HttpsBinding" closeTimeout="00:05:00"
openTimeout="00:05:00" receiveTimeout="00:05:00" sendTimeout="00:05:00">
<security mode="Transport">
<transport clientCredentialType="Windows" proxyCredentialType="None">
<extendedProtectionPolicy policyEnforcement="WhenSupported" />
</transport>
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
我的客戶端使用相同的綁定詳細信息成功連接到它。
我最近要求添加基本身份驗證以支持一些遺留系統。 我認為我知道的一切都說我們可以並排運行。
我啟用了基本身份驗證,舊系統可以連接。 但是,我們現有的所有WCF客戶端現在都拋出以下異常:
MessageSecurityException:HTTP請求未經授權,客戶端身份驗證方案為“Negotiate”。 從服務器收到的身份驗證標頭是'Basic realm =“mydomain.local”,Negotiate,NTLM'。
問候,Rob。
好吧,事實證明這是我遇到的更具誤導性的Microsoft錯誤消息之一。
正在初始請求上創建401身份驗證錯誤,而不會在事件查看器中記錄任何異常。
答案似乎是使用system.webServer - > httpErrors
由於我想在URL中使用波浪號(〜),我將配置設置為以下內容:
<httpErrors>
<clear />
<error statusCode="401" responseMode="ExecuteURL" path="~/error.xml" />
</httpErrors>
無論是使用代字號還是ExecuteURL,我最終發現使用以下工作:
<httpErrors>
<clear />
<error statusCode="401" responseMode="File" path="/error.xml" />
</httpErrors>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.