0

ServiceSecurityContext.Current.WindowsIdentity.Name を使用して、クライアント側でサービス資格情報を取得しようとしています。しかし、 ServiceSecurityContext.Current は null として出てきます。

サービスとクライアントは、Windows 認証、メッセージ セキュリティ モード、および wsHttpBinding を使用しています。あなたの助けは非常に高く評価されています..ありがとう.

4

1 に答える 1

0

クライアントでサーバーの資格情報を取得しようとしている場合は、おそらく何か間違ったことをしています。他の方法で行っている場合は、次の設定を使用しています

BasicHttpBinding basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);              
basicHttpBinding.Security.Transport.ClientCredentialType =HttpClientCredentialType.Windows;                
reportService = new ReportingService2005SoapClient(basicHttpBinding, new EndpointAddress(reportServerUrl));
reportService.ClientCredentials.Windows.AllowNtlm = false;
reportService.ClientCredentials.Windows.AllowedImpersonationLevel =          TokenImpersonationLevel.Impersonation;
reportService.ChannelFactory.Credentials.Windows.ClientCredential =
                    CredentialCache.DefaultNetworkCredentials;

編集

MSDN

このクラスを使用して、実行時にリモート セキュリティ コンテキストに関する情報を取得します。クライアントが正常に認証され、メソッドへのアクセスが承認されると、セキュリティ コンテキストが作成されます。メッセージが正常に認証および承認されると、クライアントからのセキュリティ情報と現在のサービス インスタンスのセキュリティ情報を、このクラスのインスタンスから取得できます。

于 2012-06-20T05:46:53.407 に答える