Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp .net core wcf endpoints

I am working on a small web API that calls a WSDL soap api. The WSDL file has an endpoint set, but I would like to be able to change that in the appsetting.json file so I can have different endpoints for different environments (DEV, Production, etc.) I know in traditional .NET you could set the endpoints in the web.config file, so I tried to emulate that in the appsettings.json

 "client": {
   "endpoint": {
   "address": "https://testaddress.com:9000",
   "binding": "basicHttpBinding",
   "bindingConfiguration": "MyWSDLService_Binder",
   "contract": "MyWSDLNamespace.Service__PortType",
   "name": "MyWSDLService_Port"
 }
}

I set the bindingConfiguration to the name attribute in the node <wsdl:binding> in the actual WSDL and the contract to the type of that same node with the namespace of the WCF dot notated in front. The name: I set to the name attribute of the <wsdl:port> node. Essentially I want to be able to set <soap:address location> in the appsettings.json file.

like image 597
wolfman928 Avatar asked May 07 '18 17:05

wolfman928


People also ask

Can we use WCF in .NET Core?

Applications with WCF dependencies can be updated to use CoreWCF in-place on . NET framework, which then will work the same when updated to use . NET Core or . NET 5+.

How many endpoints can a WCF Service have?

The service configuration has been modified to define two endpoints that support the ICalculator contract, but each at a different address using a different binding.

Can WCF service have multiple endpoints?

As demonstrated in the Multiple Endpoints sample, a service can host multiple endpoints, each with different addresses and possibly also different bindings. This sample shows that it is possible to host multiple endpoints at the same address.

What are WCF endpoints?

Endpoints provide clients access to the functionality offered by a WCF service. Each endpoint consists of four properties: An address that indicates where the endpoint can be found. A binding that specifies how a client can communicate with the endpoint. A contract that identifies the operations available.


1 Answers

Base on this link, in ASP.NET Core, it is no yet possible to do configuration in separate configuration files. It's set just from code.

Unfortunately you have to stick with code for the moment.

like image 73
Afshar Mohebi Avatar answered Oct 12 '22 02:10

Afshar Mohebi