如何使 C# 客户端-服务器在互联网上运行?

发布于 2024-08-14 13:07:17 字数 165 浏览 2 评论 0原文

我当前正在开发的应用程序是一个客户端-服务器 C# 应用程序,并且在网络上运行良好。现在我在想它是否可以在互联网上运行。问题是如何做到这一点?如何在我的计算机上启动服务器以及在什么情况下才能通过互联网连接到每个客户端?我需要什么软件才能做到这一点?

每个想法/建议都非常有用。

谢谢。

The current application that I'm working on is a Client - Server C# application and work very well on a network. Now I'm thinking if it can run over the internet. The question is how to do this? How can I start the Server on my computer and in what circumstances so that every Client over the internet to connect to? What software I need to do this?

Every idee/advice can be very useful.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

怎言笑 2024-08-21 13:07:17

您可以为服务器使用 WCF 服务,并让客户端应用程序使用 TCP 或 Soap 或 ..

这里有很棒的信息 p& ;p 应用程序架构 和此处 MS WCF

让互联网的其余部分连接到您的服务器,在 IIS 中设置一个网站并注册一个域名,将其指向您的服务器的 IP。还要更改 host 文件以处理请求。

You could use WCF services for the server and let the client app connect to it using TCP or Soap or ..

Great info here p&p app architecture and here MS WCF

To let the rest of the internet connect to your server set up an Website in IIS and register a domain name pointing it to your server's IP. Also make changes to the host file to process the requests.

ま昔日黯然 2024-08-21 13:07:17

告诉他使用 Soap/Tcp/Wcf 是没有意义的。他已经在他的本地网络上运行了

您可以将家庭网络设置为允许来自互联网的连接。大多数路由器都支持动态 DNS 服务。每当我出门在外时,我都会使用它通过 SSH 连接到我的家用计算机。

这需要在家中设置路由器以转发适当的端口,并将其设置为与动态 DNS 服务配合使用,但之后您可以使用通过 DDNS 服务设置的域名从互联网上的任何地方访问它,一切都会顺利进行。

Telling him to use Soap/Tcp/Wcf is pointless. He already has it running on his local network.

You can set up your home network to allow connections from the internet. Most routers have support for Dynamic DNS services. I use one to SSH into my home machine whenever I'm away from home.

It would require setting up your router at home to forward the appropriate ports, and setting it up to work with the Dynamic DNS service, but afterwards you can access it from anywhere on the internet with the domain name you set up with the DDNS service, and everything should go off without a hitch.

夏の忆 2024-08-21 13:07:17

只要您所在的网络允许到您的 IP 地址的传入连接,就应该没问题。但请注意,大多数人的家庭网络设置都涉及位于您的公共 IP 地址前面的路由器,并且您的所有计算机/笔记本电脑/游戏机都只有该网络的 IP 地址。这意味着您可能需要设置路由器以将一个或两个端口转发到运行服务器的计算机。

As long as the network you are on allows incoming connections to your IP address, you should be fine. Though be aware that most people's home network setup involves a router sitting in front of your public IP address, and all of your computers/laptops/game consoles having only IP addresses for that network. This means that you will probably have to set up your router to forward a port or two to the computer running the server.

甜`诱少女 2024-08-21 13:07:17

在这种情况下,您需要做的是:

  • 从 Web 托管公司(考虑 Windows Azure)购买服务器空间,
  • 在静态 IP 上公开您的计算机并让客户端连接到该服务器。

不管怎样,我建议购买一个域名并将其指向IP。这样,如果/当您托管它的位置发生变化时,您可以提交 DNS 更改,并且域将指向新位置。

一旦您拥有一个公开的系统,就可以设置一个 Web 服务来响应客户端请求。

In this case what you're going to need to do is either:

  • purchase server space from a web hosting company (consider Windows Azure)
  • expose your computer on a static ip and have the clients connect to that.

Either way I'd suggest buying a domain and pointing it to the ip. That way if/when the location where you're hosting it changes you can submit a dns change and the domain will point to the new location.

Once you have a publicly exposed system in place set up a web service to respond to the client requests.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文