I. Background
In the process of program development in C #, we will use the server to be deployed, so we need to open the server port, basically such use TCP / IP protocol, so in this blog we will tell how to deploy a C # program and run it in centos7 above.
Second, the environment
The server uses the server is centos7
Use of C # is a program developed by others on the team
Third, the method
1. Turn off the firewall
Turn off the firewall, so that you can open all of the ports, but this will involve a lot of security issues undesirable.
2. The development of the corresponding port
In addition to using a method other than turning off the firewall, we can also use development on a specific port, so you can be mapped to a port on a specific program.
Here we use the second method
Specific steps
2.1 open a port
Using the following instructions to develop a specific port
# 9641 to develop a port in public areas
firewall-cmd --zone=public --add-port=9641/tcp --permanent
result
Note: Since I've been open, so suggesting a port has been open information
2.2 View
Use the following command to query
firewall-cmd --list-ports
result
2.3 to run the program
Using the following instructions to run a program in C #
# Use instructions mono start a C # program
mono TTSServer.exe
result
2.4 Program test
2.4.1 using telnet test
Windows10 case of using cmd, and then enter telnet [IP test] [Test port]
With the following instruction
# Personal ip and open the front port
telnet 114.55.245.217 9641
result
Service-Terminal
Client
2.4.2 Supplementary
In the process used in the presentation information may not find telnet command. This is because the detection method telnet is not enabled by default, but you need to manually open.
1. Access Remove Programs interface
result
2. 开启Telnet
点击【启用或关闭Windows功能】找到Telnet Client,勾选确定之后会有提示重启一下就可以了。
结果
四、总结
这个只是比较简单的方法,还有开放一个范围的命令,也和这个类似。由于很多的东西都需要部署到服务器上面,因此我们需要掌握这些基本的指令。而且在使用Linux的时候感受到了它的灵活性,确实十分的不错。
五、参考
附上参考的一些人的blog,有更详细的端口开放的方法。
这个作者的介绍是比较详细的
https://www.cnblogs.com/heqiuyong/p/10460150.html
这个作者的操作比较简略
https://www.cnblogs.com/jpfss/p/9734522.html
这个作者有介绍不同版本的操作
https://www.cnblogs.com/inos/p/10985042.html