简体   繁体   中英

How can make a C# Client - Server run over internet?

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.

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.

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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