次のコードがあります
var factory = new ChannelFactory<INewsClient>();
factory.Credentials.ClientCertificate.Certificate = GetCertificate();
factory.Endpoint.Address = new EndpointAddress("https://blabla.com/myservice/");
var binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
factory.Endpoint.Binding = binding;
var channel = factory.CreateChannel();
channel.GetNews();
.NET 3.5 では動作しますが、.NET4.0 では動作しません。ビザールか?私が使用している証明書は、ローカル マシン (チェーンなし) で検証されません。3.5 では、クライアント証明書の有効性は SSL の確立には関係ありませんが、4.0 に移行すると、証明書は SSL に使用される前に検証されます。(CAPI2 イベント ログにエラーが表示されます)。醜い SecurityNegotiationException が発生します...
スタックトレース:
System.ServiceModel.Security.SecurityNegotiationException: 権限 'pep.uat.dialectpayments.com' で SSL/TLS の安全なチャネルを確立できませんでした。---> System.Net.WebException: 要求が中止されました: SSL/TLS セキュア チャネルを作成できませんでした。 System.Net.HttpWebRequest.GetResponse() で System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply (TimeSpan タイムアウト) で --- 内部例外スタック トレースの終了 --- サーバー スタック トレース: System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException (WebException webException、HttpWebRequest 要求、HttpAbortReason abortReason) で System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply (TimeSpan タイムアウト) で System.ServiceModel.Channels.RequestChannel.Request (メッセージ メッセージ、TimeSpan タイムアウト) で System.ServiceModel.Dispatcher.RequestChannelBinder.Request (メッセージ メッセージ、TimeSpan タイムアウト) で System.ServiceModel.Channels.ServiceChannel.Call (文字列アクション、Boolean oneway、ProxyOperationRuntime 操作、Object[] ins、Object[] outs、TimeSpan タイムアウト) で System.ServiceModel.Channels.ServiceChannelProxy.InvokeService (IMethodCallMessage methodCall、ProxyOperationRuntime 操作) で System.ServiceModel.Channels.ServiceChannelProxy.Invoke (IMessage メッセージ) で [0] で例外が再スローされました: System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage (IMessage reqMsg、IMessage retMsg) で System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke (MessageData& msgData、Int32 型) で ConsoleApplication2.Program.INewsClient.Get() で d:\dev\ConsoleApplication2\Program.cs:line 44 の ConsoleApplication2.Program.Main(String[] args) で
私たちのセキュリティ アーキテクチャでは、証明書はサーバー上の LDAP ディレクトリに対して検証されるため、クライアントが完全なチェーンを知る必要はありません。
質問は、この新しい動作を無効にするにはどうすればよいですか?