0

Windows 認証モードで Web サービスを実行しています。

asmx 接続にテキストを送信するアプリケーションがあります。

BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
BasicHttpBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;

EndpointAddress endpoint = new EndpointAddress("http://xyzts/Service.asmx");
WS_SPIL.ServiceSoapClient client = new WS_SPIL.ServiceSoapClient(basicHttpBinding, endpoint);

client.ClientCredentials.Windows.AllowedImpersonationLevel = Sytem.Security.Principal.TokenImpersonationLevel.Impersonation;
client.ChannelFactory.Credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;

次のコードを (ASMX で) 実行します: Windows AD ログインを返す User.Identity.Name。

ここまでは順調ですね。

今、私はログインユーザーでデータベースに接続したいと考えています。しかし、現在のユーザー (IIS ユーザー) には SQL サーバーに接続する権限がないというエラー メッセージが表示されます。

try
{
    SqlConnectionStringBuilder csb = new SqlConnectionStringBuilder();
    csb.DataSource = "sqlservername";
    csb.InitialCatalog = "DBName";
    csb.IntegratedSecurity = true;

    SqlConnection conn = new SqlConnection();
    conn.ConnectionString = csb.ToString();
    conn.Open();
    conn.Close();

    return "ok";
}
catch (Exception ex)
{
    return ex.ToString();
}
4

1 に答える 1

0

これは「ダブルホップ問題」のケースのように思えます。基本的に、Kerberos を実装していない限り、偽装された資格情報を SQL Server で使用することはできません。

于 2012-06-26T20:52:34.613 に答える