Skip to content

Please provide comprehensible information about WCF in .NET Core #4122

Open
@arphox

Description

@arphox

Hi!

I am writing this issue to recommend You to provide comprehensible information about WCF in .NET Core.
Please let me justify why I recommend it with some facts:

Intro

  • Searching for "wcf in .net core" on google shows the "What replaces WCF in .Net Core?" question as first result which has an accepted answer starting with "WCF is not supported in .NET Core". Based on this, a developer could suppose that there is no WCF in .NET Core. Fortunately, this is not entirely true.
  • Link to this repository (dotnet/wcf) is rather easy to find and the description says that here are "client-oriented WCF libraries" (which I did not understand first; "what is client-oriented?"). Alright, so it seems that I can consume WCF services in .NET Core. Let us find out how.
  • I could not find any developer guide for .NET Core in WCF. For the .NET framework version, there are a lot of material (though they do not really clearly state that applies only for .NET Framework), but for .NET Core, none on docs.microsoft.com as I saw.

Configuration opportunities

.NET Framework: you add a service reference to the project, and XML-based configuration will be generated to your app.config file, inside the <system.serviceModel> tag. This is fine and required (if you remove this configuration, your code won't work). For different enviroments (test, prod) you only have to change the XML configuration (e.g. ASP.NET web.config files as transforms).

.NET Core: XML-based configuration does not really exist since in .NET Core, the place for settings (as far as I know) is the appsettings.json file, and had no idea how to configure it in configuration files.

  • I have found the generated ConnectedService.json which turned out is only used for the client generation tool. (Turned out from a github issue, not a documentation or guide or so which is sad for me).
  • With lack of official documentation about this area, I had to google and I have found the article "Using WCF With .NET Core" by Jon Seeley; and there he states there is no built-in file configuration opportunities for WCF in .NET Core and he constructed a solution for it. But he abandoned it when he saw that the .NET Core version is a lot worse in terms of performance (1/3 as fast).
    So now, two questions arises in my head:
  • How to configure WCF in .NET Core with files? -> sure, for hello world applications, your library works out of the box, but if it is not configurable outside of code, it is not really usable for applications in production or for anything serious in general.
  • Is the performance really that bad? And why? -> I was planning to migrate our WCF client code to .NET Core until I found out that this can be a lot slower than in .NET Framework. Now I am stuck; will we need to migrate it to gRPC when we want to switch to .NET Core? Is a gRPC client even compatible with a WCF service? Or does it need a "gRPC service"?

Of course I found code in the generated Reference.cs file for client classes which have several constructors those allow to inject various EndpointConfiguration, endpoint addresses and so on; but is this the only way to configure it (again, I repeat, I miss documentation so much)? If yes, that means we will have to build our own file config management system (sections, elements, etc) and create clients with those settings, but all these require a lot of extra code.

Closing words

In my opinion, the best place for such documentation and knowledge base would be here, in this repository; I say that it should be at the beginning of the README, because developers are simply lost without information like these. And under documentation I do not only mean the answers for my questions, but a complete guide to what a WCF has been and what it will be in the future, from the client side.

Looking for advice

I also would like to ask advice about our production application: currently, we have a .NET Framework application which has like ~12 WCF service reference along with generated client code those are tens of thousands line of code. We only use WCF for consuming. We have a NuGet package which encapsulates and simplify all these communication and our main business applications use this NuGet package to communicate with the service. The services are third party for us, so we cannot change their side.
We configure this NuGet in our ASP.NET applications' Web.config file (and tests' app.config file); all these in .NET Framework. We want to update our NuGet to .NET Standard so our new .NET Core-based "ASP.NET Core" services will also be able to use this NuGet. So both our legacy and new systems will be able to work on the same NuGet.
I think this is (or will be) a relatively common scenario in the future and it would be great if you could give some advice related this question.

Thank you very much in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationDocumentation work is needed.infrastructureIssues related to the build, packaging, testing or related areas.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions