简体   繁体   English

是否可以通过httpwebrequest使用WCF服务(托管为Windows服务托管)?

[英]Is it Possible to consume WCF service (which is hosted as Windows Service Hosting) through httpwebrequest?

I have to create a windows service for reading some machines data for the customer client application. 我必须创建一个Windows服务来读取客户客户端应用程序的一些机器数据。 But, I dont have option to host the service in IIS. 但是,我没有选择在IIS中托管服务。 Customer can only consume the service through web url using webrequest. 客户只能使用webrequest通过网址使用服务。 Is there any possibility to consume the WCF service hosted in windows service using webrequest. 是否有可能使用webrequest使用Windows服务中托管的WCF服务。

Hosting method should not be in IIS and consuming the service should be a type of webrequest (I dont have any idea on this). 托管方法不应该在IIS中,并且使用该服务应该是一种webrequest(我对此没有任何想法)。 client will only call net.tcp,http URL types to consume the service. 客户端只会调用net.tcp,http URL类型来使用该服务。

Thanks in advance. 提前致谢。

Yeah - WCF services are just SOAP services so it's quite possible to call them with any decent HTTP client. 是的 - WCF服务只是SOAP服务,所以很有可能用任何体面的HTTP客户端调用它们。

I'd suggest you use a tool like Postman to debug your service, which should make this pretty clear - This blog post is about just that: https://code.firozansari.com/2017/10/21/making-wcf-service-request-using-postman/ 我建议你使用像Postman这样的工具来调试你的服务,这应该很清楚 - 这篇博文就是这样的: https//code.firozansari.com/2017/10/21/making-wcf-服务请求使用-邮递员/

You can also have a look at these examples that demonstrate calling a WCF SOAP service using simple HTTP clients in other languages: 您还可以查看这些示例,演示如何使用其他语言的简单HTTP客户端调用WCF SOAP服务:

http://mkonrad.blogspot.com/2013/02/call-custom-wcf-soap-service-from.html http://mkonrad.blogspot.com/2013/02/call-custom-wcf-soap-service-from.html

https://www.aspsnippets.com/Articles/Call-Consume-REST-WCF-Service-SVC-using-WebClient-in-ASPNet-with-C-and-VBNet.aspx https://www.aspsnippets.com/Articles/Call-Consume-REST-WCF-Service-SVC-using-WebClient-in-ASPNet-with-C-and-VBNet.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM