You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When going from .Net 8 to .Net 9 and setting up a Named HttpClient for DI with a handler the certificate is never sent. Verified the certificate is never sent by using WireShark to intercept the network communications.
Reproduction Steps
.Net 8
services.AddHttpClient("NamedClient",
client => { client.BaseAddress = new Uri("serverUrl"); })
.ConfigurePrimaryHttpMessageHandler(() =>
{
var handler = new HttpClientHandler
{
ClientCertificateOptions = ClientCertificateOption.Manual
};
var certs = new X509Certificate2(
configuration.GetValue<string>("CertPath")!,
configuration.GetValue<string>("CertPassword")!, X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.MachineKeySet);
handler.ClientCertificates.Add(certs);
return handler;
}
)
.Net 9, Also tired with the same Obsolete code using new X509Certificate2 with the same result.
services.AddHttpClient("NamedClient",
client => { client.BaseAddress = new Uri("serverUrl"); })
.ConfigurePrimaryHttpMessageHandler(() =>
{
var handler = new HttpClientHandler
{
ClientCertificateOptions = ClientCertificateOption.Manual
};
var certs =X509CertificateLoader.LoadPkcs12FromFile(
configuration.GetValue<string>("CertPath")!,
configuration.GetValue<string>("CertPassword")!, X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.MachineKeySet);
handler.ClientCertificates.Add(certs);
return handler;
}
)
Expected behavior
Certificate is sent during handshake.
Actual behavior
No certificate sent
Regression?
Worked as Expected .Net 8
Known Workarounds
No response
Configuration
.Net 9 RC2
Windows 11 x64
Other information
No response
The text was updated successfully, but these errors were encountered:
Description
When going from .Net 8 to .Net 9 and setting up a Named HttpClient for DI with a handler the certificate is never sent. Verified the certificate is never sent by using WireShark to intercept the network communications.
Reproduction Steps
.Net 8
.Net 9, Also tired with the same Obsolete code using new X509Certificate2 with the same result.
Expected behavior
Certificate is sent during handshake.
Actual behavior
No certificate sent
Regression?
Worked as Expected .Net 8
Known Workarounds
No response
Configuration
.Net 9 RC2
Windows 11 x64
Other information
No response
The text was updated successfully, but these errors were encountered: