How to consume wcf in .net core without adding service reference?

假如想象 提交于 2021-02-07 14:20:26

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!