Operation Not Supported on This Platform When Consuming WCF Service in .NET 8

danr 471996 0 Reputation points
2025-04-10T15:58:46.18+00:00

untering the error "Operation not supported on this platform" while attempting to consume a WCF service from .NET 8. The service is built in .NET Framework with wsHttp security. The implementation involves passing a username, password, and a certificate, yet the operation fails.

Is there a method to successfully consume services with this type of security? Various approaches have been explored without success.

The code in use is as follows:

var wsHttpBindingWithCredential = new WSHttpBinding();
wsHttpBindingWithCredential.Security.Mode = SecurityMode.Message;
wsHttpBindingWithCredential.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
wsHttpBindingWithCredential.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
wsHttpBindingWithCredential.Security.Message.EstablishSecurityContext = false; 
var endpoint = new EndpointAddress("http://serviciotimbrefiscalprueba.dgi.gob.ni/TimbreFiscalDigital.svc");
var svctestclient = new TimbreFiscalDigitalClient(wsHttpBindingWithCredential, endpoint);
svctestclient.ClientCredentials.UserName.UserName = identity.user;
svctestclient.ClientCredentials.UserName.Password = identity.password;
svctestclient.Endpoint.Binding.SendTimeout = TimeSpan.FromMinutes(5);
svctestclient.Endpoint.Binding.ReceiveTimeout = TimeSpan.FromMinutes(5);
var store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
var certs = store.Certificates.Find(
    X509FindType.FindBySubjectName,
    "timbrefiscal.dgi.gob.ni",
    validOnly: false
);
if (certs.Count == 0)
{
    throw new Exception("Certificate not found");
}
     
var clientCertificate = certs[0];
store.Close();
svctestclient.ClientCredentials.ClientCertificate.Certificate = clientCertificate;
svctestclient.Open();
Developer technologies | ASP.NET | ASP.NET API
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 79,101 Reputation points Volunteer Moderator
    2025-04-11T15:47:08.4433333+00:00

    the .net core version of WCF is an open source project and only a subset of WCF:

    https://github.com/CoreWCF/CoreWCF

    you could check the issues.

    note: MS recommends changing technology, say to gRPC.

    0 comments No comments

  2. Jack Dang (WICLOUD CORPORATION) 1,020 Reputation points Microsoft External Staff
    2025-07-15T04:35:07.81+00:00

    Hi,

    Based on your issue and the error message "Operation not supported on this platform", you're encountering a known limitation in .NET 8 when trying to consume a WCF service using WSHttpBinding with message-level security and client certificates.

    .NET Core and .NET 5+ (including .NET 8) do not fully support WSHttpBinding, especially with advanced security configurations like:

    SecurityMode.Message

    MessageCredentialType.UserName

    Client certificates

    This is because WCF in .NET Core/.NET 5+ is not fully implemented. Microsoft has not ported the full WCF stack to .NET Core/.NET 8. Instead, they recommend using CoreWCF, a community-driven project that aims to bring WCF server-side capabilities to .NET Core 1.

    Here are some workaround options:

    Option 1: Use CoreWCF (if you control the service)

    If you have control over the WCF service, consider migrating it to CoreWCF, which supports many WCF features and is actively maintained.

    GitHub: https://github.com/CoreWCF/CoreWCF

    Notice: CoreWCF is primarily for server-side WCF. For clients, you still need to work around limitations in .NET.

    Option 2: Use .NET Framework Client

    If the service must remain as-is and uses wsHttpBinding with message security, the most reliable solution is to:

    Create a .NET Framework class library (e.g., .NET 4.8)

    Add your WCF client code there

    Reference this library from your .NET 8 application via COM interop or gRPC bridge

    This allows you to use the full WCF stack without rewriting the service.

    Hope this helps.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.