2012-03-01 9 views
3

私はWindows認証のWCFサービスを持っています。Windows認証WCFサービスの使用

次のような構成の使用:

BasicHttpBinding binding = new BasicHttpBinding(); 
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm; 
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; 
binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; 

binding.SendTimeout = TimeSpan.FromMinutes(60); 
binding.CloseTimeout = TimeSpan.FromMinutes(60); 
binding.OpenTimeout = TimeSpan.FromMinutes(60); 
binding.ReceiveTimeout = TimeSpan.FromMinutes(60); 

NexumCrmServiceClient client = new NexumCrmServiceClient(binding, new EndpointAddress("http://xxxxxx:81/xxxxxxxxxxxxxx.svc")); 
client.ClientCredentials.Windows.AllowNtlm = true; 
//client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; 
client.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("xxxxxxxx", "xxxxxxxx", "xxxxxxxxx"); 

私はこのエラーを取得しています:

There was no endpoint listening at http://xxxxxx:81/xxxxxxxxxxxxxxxx.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details...

そして、私は下のコンフィギュレーションを使用する場合:

BasicHttpBinding binding = new BasicHttpBinding(); 
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm; 

binding.SendTimeout = TimeSpan.FromMinutes(60); 
binding.CloseTimeout = TimeSpan.FromMinutes(60); 
binding.OpenTimeout = TimeSpan.FromMinutes(60); 
binding.ReceiveTimeout = TimeSpan.FromMinutes(60); 

NexumCrmServiceClient client = new NexumCrmServiceClient(binding, new EndpointAddress("http://xxxxxx:81/xxxxxxxxxxxxxx.svc")); 
client.ClientCredentials.Windows.AllowNtlm = true; 
//client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; 
client.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("xxxxxxxx", "xxxxxxxx", "xxxxxxxxx"); 

私は別のものを取得していますがエラー:

The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.

正常に動作する構成をお勧めしますか?事前に

おかげで、

+0

正確な回答が得られるようにサービス設定を投稿してください。 – RoccoC5

答えて

5

私はあなたが設定する必要があると考えている:

binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows 

をあなたの質問のタイトルが参照しているものを手に入れます。また、basicHttpBindingでのWindows認証の使用については、このMSDN articleを確認してください。

関連する問題