简体   繁体   English

如何托管WCF服务

[英]How to host a WCF service

I am trying to create a chat application in WCF. 我正在尝试在WCF中创建聊天应用程序。 I've created the client and the service on a localhost using httpBinding, this is the service endpoint: 我已经使用httpBinding在本地主机上创建了客户端和服务,这是服务端点:

http://localhost:9999/ProductService http:// localhost:9999 / ProductService

Now, I really don't know how to make the program run 'globaly' and not on a localhost. 现在,我真的不知道如何使程序“全局”运行,而不是在本地主机上运行。 Is there anyway to host the server on my pc? 无论如何,我的电脑上是否可以托管服务器? or run the application serverless using p2p communications? 还是使用p2p通信在无服务器的情况下运行应用程序? Thanks anyway for your Time 谢谢你的时间

You can set up at publicly accessible web server on your own computer, but it's definitely not recommended for any production purposes, unless you have a good understanding of this and have a internet-connection that allows for it, both technically and legally. 您可以在自己的计算机上的可公开访问的Web服务器上进行设置,但绝对不建议将其用于任何生产目的,除非您对此有所了解并在技术上和法律上都可以进行互联网连接。

You should probably get external web hosting for this instead. 您可能应该为此获得外部虚拟主机。

But if you really want to do this, you can install IIS to host the service. 但是,如果您确实要执行此操作,则可以安装IIS来承载该服务。

As a side note, I don't think WCF is the optimal route to take for this anymore. 顺带一提,我认为WCF不再是解决此问题的最佳途径。 Maybee you should check out SignalR and/or WebSockets instead. Maybee您应该改为检出SignalR和/或WebSockets。 And ASP.NET Core WebAPI. 和ASP.NET Core WebAPI。 It's not really anything wrong with WCF, but for new projects I wouldn't recommend it. WCF并没有什么错,但是对于新项目,我不推荐这样做。

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

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