我有一個WCF服務,使用basicHttpBinding的和Windows身份驗證(不匿名),使用WCF與basicHttpBinding的和Windows身份驗證
WCF服務在域服務器 託管我需要從一個服務器使用服務這是超出域,該服務器不加入域,這是一個工作組。那可能嗎?請爲代碼片段提供幫助。
像下面
<bindings>
<basicHttpBinding>
<binding name="defaultBinding" receiveTimeout="01:00:00" sendTimeout="01:00:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="defaultServiceBehavior">
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="defaultServiceBehavior" name="namespace.MyService">
<endpoint binding="basicHttpBinding" bindingConfiguration="defaultBinding" contract="namespace.IMyService">
<identity>
<dns value="abc.xyz.com"/>
</identity>
</endpoint>
</service>
</services>
編輯的配置:這裏是我的客戶端代碼
_securityServiceClient = new SecurityServiceClient();
_securityServiceClient.ClientCredentials.UserName.UserName = "lto3";
_securityServiceClient.ClientCredentials.UserName.Password = "[email protected]";
我得到這個錯誤
型System.ServiceModel.Security的」異常。 MessageSecurityException'發生在mscorlib.dll中,但未在用戶代碼中處理
附加信息:HTTP請求在客戶端 「基本」身份驗證方案中未經授權。從 服務器收到的驗證頭是「Negotiate,NTLM」。
這是所有WCF教程中介紹的最基本的場景之一。你有什麼嘗試,有什麼問題?客戶代碼在哪裏? –
您好,感謝您的期待,我收到了此消息{「該HTTP請求未經客戶端身份驗證方案'Basic'授權,從服務器收到的身份驗證頭是'Negotiate,NTLM'。}}這裏是我的客戶端代碼_securityServiceClient = new SecurityServiceClient(); _securityServiceClient.ClientCredentials.UserName.UserName =「domain \\ account」; _securityServiceClient.ClientCredentials.UserName.Password =「password」; – khoailang
你好,可以請指教 – khoailang