问题
net core, I want to consume a wcf service in my core application without adding service reference? I am able to consume wcf by installing wcf connected service and adding service reference but I don't want to add any service reference.
回答1:
if you are using wcf service then you can expose it as a restful service. then you can simply consume it. actully i have been use it for many years and its been really useful. here you can read more about that: REST / SOAP endpoints for a WCF service
回答2:
Please refer to the follow link. It has some minors issues, but is easy to fix.
Calling Web Method Without a Service Reference
回答3:
you can create a service proxy using svcutil.exe and use the proxy class as a reference.
here is a sample:
SvcUtil.exe http://www.temperatureservice.com:8080/TemperatureService.svc /ser:DataContractSerializer /s /language:cs /out:TemperatureServiceProxy.cs /n:*,WCF.Client.Proxies.Proxy
It will generate TemperatureServiceProxy.cs file, include this file in your project and create a service client by referencing this file.
来源:https://stackoverflow.com/questions/42018402/how-to-consume-wcf-in-net-core-without-adding-service-reference