使WCF服务可通过Internet访问 [英] Make WCF service be accessible through Internet

查看:74
本文介绍了使WCF服务可通过Internet访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经提供了WCF服务.我希望它的客户端可以从任何地方访问它.我怎样才能做到这一点? 详细信息:

I've made a WCF service. I want it's client to be able to access it from anywhere. How can I do that? Details:

  • 我希望将其托管在Windows中 过程,而不是网站.
  • 我正在使用TCP绑定.
  • 我对虚拟主机等几乎一无所知.
  • 最好不要使用IIS ...
  • I want it to be hosted in a Windows process, not a site.
  • I'm using TCP binding.
  • I don't know almost anything about web hosting etc.
  • It's desirable not to use IIS...

我在网络上找到了很多建议,但仍然不了解所有内容.请告诉我详细操作方法...

I have found many recommendations in the web, but still do not understand all the stuff. Please, tell me how to do it in details...

据我了解,有必要对端点进行全局设置.我已经在路由器中将端口转发配置为8000端口,但是..还有什么?我应该输入哪个地址作为端点地址?现在是localhost:8000.

As I understand, it's necessary to make a global for the endpoint. I've configured port forwarding in my router to the 8000 port, but .. what's further? What address should I enter as the endpoint address? It's now localhost:8000.

推荐答案

您将需要上面建议的公共IP地址或域名.找出您是否已经拥有它,如果没有,请按照上面的建议进行设置.

You will need a public IP address or domain name like suggested above. Find out if you already have it, if not follow the suggestions above on setting that up.

对于WCF主机和客户端,您将需要如下所示的端点:

For your WCF host and client, you will need endpoint that look like this:

  • 主机:net.tcp://localhost:portnum/servicename
  • 客户端:net.tcp://publicipORdomainname:portnum/servicename

您将需要确保路由器将端口路由到主机PC.从问题听起来好像您已经正确完成了.因为主机是本地主机,所以您不必更改端点即可使用公共ip或域名.客户端需要解决对驻留在远程地址上的主机的呼叫,因此需要可寻址的公共IP.

You will need to make sure that your router route the port to the host PC. From the question sounds like you have done it correctly. Because the host is local, you dont have to change the endpoint to use public ip or domain name. The client needs to resolve the call to the host which resides on the remote address, hence need the addressable public IP.

这篇关于使WCF服务可通过Internet访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆