Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NETCore WCF basicHttpBinding

I'm in the process of rewriting a console application in .NET Core that calls an external web service.

I'm currently getting the following error:

One or more errors occurred. (The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM, Negotiate'.)

I was able to resolve this in the old version of the application by updating the App.config as follows:

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="EmployeeSoap" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
          <security mode="Transport">
            <transport clientCredentialType="Ntlm" />
            <message clientCredentialType="Certificate" algorithmSuite="Default" />
          </security>
        </binding>
        <binding name="EmployeeSoap1" />
      </basicHttpBinding>
      <customBinding>
        <binding name="EmployeeSoap12">
          <textMessageEncoding messageVersion="Soap12" />
          <httpsTransport />
        </binding>
      </customBinding>
    </bindings>
    <client>
      <endpoint address="https://..." binding="basicHttpBinding" bindingConfiguration="EmployeeSoap" contract="TEST.EmployeeSoap" name="EmployeeSoap" />
    </client>
  </system.serviceModel>

I can't seem to find any good resources to show my how to accomplish this in .NET Core. I was hoping someone could point me in the right direction.

Thanks in advance.

like image 738
Matthew Meppiel Avatar asked Jun 17 '18 17:06

Matthew Meppiel


1 Answers

I had a related issue with getting System.ServiceModel.BasicHttpBinding to resolve correctly in .NET Core 5. I had to install the Nuget package System.ServiceModel.Http.

This corrected a problem with the Connected Services, after attempting to add a new Connected Service with Microsoft WCF Web Service Reference Provider. After setting the endpoint and generating the connection reference, the References.cs could not build. Adding this package fixed the problem.

like image 158
Cryptc Avatar answered Oct 18 '22 19:10

Cryptc