1

パートナーの Web サービスにアクセスする必要があります。サービスは、クライアント証明書と基本認証の両方で保護されています。BasicHttpBindingでWCFを使用しています。

トランスポート レベルのセキュリティを使用して証明書を接続できます。403エラーが発生しなくなったため、証明書が機能していることはわかっていますが、トランスポートとともに資格情報を渡すことができないため、401を取得しています。私が見る限り、トランスポート セキュリティ スキームは 1 種類しかありません。

どうすればこれを達成できますか?

<security mode="Transport">
     <transport type="Certificate" />
     <transport type="Basic" />
</security>

ありがとう

4

1 に答える 1

3

メッセージ レベルで資格情報を渡そうとしましたか。設定は次のようになります。

<security mode="Transport">
        <transport clientCredentialType="Certificate" proxyCredentialType="None" realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
</security>

そしてコードで

 WebServiceProxy objClient = new WebServiceProxy ();
  objclient.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindBySubjectName, "clientCert");
 objClient.ClientCredentials.UserName.UserName = "username";
 objClient.ClientCredentials.UserName.Password = "Password";
于 2011-11-21T16:50:42.580 に答える