Authentication Issues with .NET 4.5 DLL accessing SOAP 1.2 services

Viewed 54

We are working on a project where we need to access SOAP 1.2 services and convert to JSON using a DLL. We have built out everything and are stumped by authentication issues in .NET 4.5, which do not occur in .NET 5. We believe this to be a simple configuration issue but probably have gotten to myoptic trying to get it work. Curious if anyone has tripped across a similar issue and have any insights...

Background:

  • The SOAP secured is secured using Windows Authentication (NTLM) at the IIS web server with no role-based authentication.
  • The SOAP service is based off of SOAP 1.2
  • The SOAP service consumer client must work from within a DLL (not an EXE) to be integrated with a web application; since the client code is within a DLL, the parent application's configuration cannot be changed; work within the .NET 4.5 Framework (we have code that works in .NET 5); and, we cannot touch the server hosting the SOAP 1.2 services.
  • WCF is being used to create the SOAP binding within the DLL
  • The WSHttpBinding class is used because of the SOAP 1.2 protocol
  • The binding currently configured within the DLL

Our issue:

  • We are receiving a "The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM,Negotiate'" exception when calling a bound function
  • Sample code:
WSHttpBinding binding = new WSHttpBinding();
binding.Security.Mode = SecurityMode.None;
EndpointAddress endpointAddress = new EndpointAddress("http://...SummaryService.svc");                
ServiceClient client = new ServiceClient(binding, endpointAddress);
var result = await client.SomeFunctionAsync();

NOTE: When this code is run from a .NET 5.0 application, there are no issues; it is only within an .NET 4.5 .DLL/.EXE that I see this error.

Any suggestions come to mind? TIA

1 Answers

You can check your configuration by following these steps :

  1. Check your security mode and set to TransportCredentialOnly.

  2. Ensure the server-side and the client-side are the same binding.

  3. Set the proxy class to allow impersonation.

    Customer_PortClient proxy = new Customer_PortClient(); proxy.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation

Related