Trouble adding a Web Service to .NET Core project

227 views Asked by At

I have a .NET Core 3.1 project, to which I need to add a web service. I can add it regularly as a service reference, however it does not work, returns "There was no endpoint listening at "xxx" that could accept the message. This is often caused by an incorrect address or SOAP action".

Now, the service is up and running, and connections are triple checked and completely ok. I've made a .NET Framework 4.5 app, to emulate the work of the Core application, and there when I add it as a service reference, it returns the same error.

However, when i add it as a web reference (which generates code based on FW 2.0), it works properly. (that option is not available in Core, at least not to my knowledge)

Is there any way to emulate generating the code based on 2.0 in .NET Core, i've tried using dotnet-svcutil (no additional configuration, just the basic install), but still to no awail.

Any help?

1

There are 1 answers

0
Parag Mehta On
  • Double check that the endpoint address and bindings are correct in the service reference configuration. Small mistakes in the URL or contract names can lead to these connectivity issues.
  • Try updating the service reference to use basicHttpBinding rather than the default wsHttpBinding. Basic binding is more interoperable and may connect better from .NET Core.
  • Generate the service proxy code using a tool like svcutil or wsdl.exe instead of adding the service reference. It gives you more control over the binding configurations. You can specify basicHttpBinding here.
  • For svcutil, use the /serviceContract option to specify the interface namespace and class name explicitly. The generated code may work better if you control the contract naming.
  • As a last resort, try hosting the web service in IIS instead of self-hosted, if possible. IIS-hosted services play nicer with .NET Core in some cases.
  • Review the .NET Core compatibility for the SOAP libraries you're using on the service implementation. Some older libs like ASMX have limitations on .NET Core. The key is getting the right mix of binding, contract names, and namespace mappings between the client proxy code and the actual service. With trial and error, you should be able to find a generation approach that creates compatible code for your scenario.