Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.InvalidOperationException : The client certificate is not provided. #458

Closed
StephenBonikowsky opened this issue Oct 23, 2015 · 2 comments
Labels
bug This is a product bug.

Comments

@StephenBonikowsky
Copy link
Member

The test case for #Issue366 is failing due to the following exception.

System.InvalidOperationException : The client certificate is not provided. Specify a client certificate in ClientCredentials.

at System.ServiceModel.ClientCredentialsSecurityTokenManager.CreateSecurityTokenProvider(SecurityTokenRequirement tokenRequirement) in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Security\ClientCredentialsSecurityTokenManager.cs:line 108
at System.ServiceModel.Channels.SslStreamSecurityUpgradeInitiator..ctor(SslStreamSecurityUpgradeProvider parent, EndpointAddress remoteAddress, Uri via) in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\SslStreamSecurityUpgradeProvider.cs:line 478
at System.ServiceModel.Channels.SslStreamSecurityUpgradeProvider.CreateUpgradeInitiator(EndpointAddress remoteAddress, Uri via) in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\SslStreamSecurityUpgradeProvider.cs:line 225
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.d__10.MoveNext() in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\FramingChannels.cs:line 282
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at System.ServiceModel.Channels.ConnectionPoolHelper.<EstablishConnectionAsync>d__15.MoveNext() in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\ConnectionPoolHelper.cs:line 113 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.d__14.MoveNext() in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\FramingChannels.cs:line 368
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at System.ServiceModel.Channels.CommunicationObject.d__71.MoveNext() in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\CommunicationObject.cs:line 348
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at System.ServiceModel.Channels.ServiceChannel.d__149.MoveNext() in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\ServiceChannel.cs:line 1351
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at System.ServiceModel.Channels.CommunicationObject.d__71.MoveNext() in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\CommunicationObject.cs:line 348
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at System.ServiceModel.Channels.CommunicationObject.d__70.MoveNext() in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\CommunicationObject.cs:line 323
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at System.Runtime.TaskHelpers.WaitForCompletion(Task task) in C:\OSS\wcf\src\System.Private.ServiceModel\src\Internals\System\Runtime\TaskHelpers.cs:line 184
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\CommunicationObject.cs:line 317
at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout) in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\ServiceChannel.cs:line 1976
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade) in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\ServiceChannel.cs:line 2043
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout) in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\ServiceChannel.cs:line 502
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\ServiceChannel.cs:line 747
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\ServiceChannel.cs:line 722
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(MethodCall methodCall, ProxyOperationRuntime operation) in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\ServiceChannelProxy.cs:line 371
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(MethodInfo targetMethod, Object[] args) in C:\OSS\wcf\src\System.Private.ServiceModel\src\System\ServiceModel\Channels\ServiceChannelProxy.cs:line 139
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Reflection.DispatchProxyGenerator.Invoke(Object[] args)
at generatedProxy_1.Echo(String )
at Tcp_ClientCredentialTypeTests.TcpClientCredentialType_Certificate_EchoString() in C:\OSS\wcf\src\System.Private.ServiceModel\tests\Scenarios\Security\TransportSecurity\Tcp\ClientCredentialTypeTests.cs:line 158

@StephenBonikowsky StephenBonikowsky added the bug This is a product bug. label Oct 23, 2015
StephenBonikowsky added a commit to StephenBonikowsky/wcf that referenced this issue Oct 23, 2015
* Added a property in BridgeClientCertificateManager to hold the thumbprint of the ClientCertificate so that a test case can get it.
* Test sets the DnsEndpointIdentity to "localhost" which means this will only work when the Bridge and the test run on the same machine.
* Hong has a PR that adds a resource to the Bridge that will return the server Identity. I will update this PR to use that Resource
   once her PR is merged, before I merge this one.
* Test currently fails due to Issue dotnet#458, added ActiveIssue
StephenBonikowsky added a commit to StephenBonikowsky/wcf that referenced this issue Oct 23, 2015
* Added a property in BridgeClientCertificateManager to hold the thumbprint of the ClientCertificate so that a test case can get it.
* Test sets the DnsEndpointIdentity to "localhost" which means this will only work when the Bridge and the test run on the same machine.
* Hong has a PR that adds a resource to the Bridge that will return the server Identity. I will update this PR to use that Resource
   once her PR is merged, before I merge this one.
* Test currently fails due to Issue dotnet#458, added ActiveIssue
@iamjasonp
Copy link
Member

I think this one's on me 😄

@hongdai
Copy link
Contributor

hongdai commented Oct 26, 2015

Setting service certificate is having the same issue. This is a simple wire fix.
In protected ClientCredentials(ClientCredentials other) , we need to clone below:

if (other._clientCertificate != null)
this._clientCertificate = new X509CertificateInitiatorClientCredential(other._clientCertificate);
if (other._serviceCertificate != null)
this._serviceCertificate = new X509CertificateRecipientClientCredential(other._serviceCertificate);
if (other._windows != null)
this._windows = new WindowsClientCredential(other._windows);

iamjasonp added a commit to iamjasonp/wcf that referenced this issue Oct 27, 2015
The protected constructor and MakeReadOnly() method does not properly clone the
_clientCertificate, _serverCertificate fields

Fixes dotnet#458
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This is a product bug.
Projects
None yet
Development

No branches or pull requests

3 participants