1

I am new to WCF in general so excuse any inconsistencies in the question.

I am trying to connect to an existing WCF service. The existing WCF service clients that I have seen using the service have used the WebHttpBinding to connect to the WCF service. However, with the new client I am making I am unable to use .NET framework and need to use .NET core where WebHttpBinding is not supported (I tried installing the nuget package for System.ServiceModel.Web and it said that the target had to be .Net Framework - it looks like the GitHub associated with potentially supporting this has not made any moves to do so https://github.com/dotnet/wcf/issues/1413). Is there anyway to connect to the existing WCF server by using normal HTTP requests? Or if not, by using other means within the WCF framework?

I've had a look at What replaces WCF in .Net Core? but its seems to suggest using different frameworks entirely.

1 Answers1

1

You are right, we can connect the existing WCF server by using certain HttpClient class library. The WCF service created by Webhttpbinding called WCF Rest service.
https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/wcf-web-http-programming-model-overview
It is not a good choice to call the Rest service by using a proxy, by which way it is more proper to call SOAP style service.
https://learn.microsoft.com/en-us/dotnet/framework/wcf/wcf-client-overview
Constructing an Http request by using Ajax,HttpClient(C#),HttpClientFactory(Core) is a good way to call the WCF service created by webhttpbinding. Specify the Http verb and attach the request body, then send the request to the service URL, that's all we need to do.
At present, the Webhttpbinding is not supported in DotNet Core.
https://learn.microsoft.com/en-us/dotnet/api/system.servicemodel.webhttpbinding?view=netframework-4.8
Feel free to let me know if there is anything I can help with.

Abraham Qian
  • 7,117
  • 1
  • 8
  • 22