A few simple steps to achieve local ASP.Net.Core web site combined with cpolar intranet penetration tool to achieve remote access
1. Create a site
*Environment construction, test here, use .NET 6.0 SDK , you can click to jump to the official website to download, download and install.
After the installation is complete, go to a certain folder, open powershell and execute the following command to create a new web application named: aspnetcoreapp
dotnet new webapp -o aspnetcoreapp
2. Run the site
Trust the development certificate, the ASP.Net Core site can use https, we execute the following command to open
dotnet dev-certs https --trust
Then enter the site directory
cd aspnetcoreapp
run site
dotnet watch run
After executing the run command, we can see that there are two access methods, one https and http
Use the https address to access, we can see the web site interface, the default will automatically jump to the browser to open, so that our site will start, the port is7032
3. Install cpolar
cpolar official website: https://www.cpolar.com/
Visit the cpolar official website, register an account, and then download and install the client. For specific installation tutorials, please refer to the official website documentation tutorial.
- Windows system: After downloading the installation package from the official website, double-click the installation package and install it by default.
- Linux system: supports one-click automatic installation scripts, please refer to the official website documentation for details - Getting Started Guide
After cpolar is successfully installed, visit the local port 9200 [ http://localhost:9200 ] on the browser , and log in with the cpolar account.
4. Create a public address
Click Tunnel Management on the left dashboard - Create Tunnel, and create a 7032 tunnel with the https access method above. The https method requires special attention when filling in the local address!
- Tunnel name: you can customize the name, be careful not to duplicate the existing tunnel name
- Protocol: select http
- Local address: https://127.0.0.1:7032
- Domain name type: choose a random domain name for free
- Region: Select China VIP
click创建
After the tunnel is successfully created, click on the status on the left - online tunnel list to view the generated public network address. There are two access methods, one is http and https
5. Public network access
We use https public network address to access, we can see our local ASP.Net.Core site, such a public network address access is created, even if the local is https can also be accessed
6. Fixed public network address
Since the above tunnel created by using cpolar uses a random public network address, it will change randomly within 24 hours, which is not conducive to long-term remote access. Therefore, we can configure a second-level subdomain name for it, which is a fixed address and will not change randomly [ps: cpolar.cn has been filed]
Note that the cpolar package needs to be upgraded to the basic package or above, and the bandwidth corresponding to each package is different. [cpolar.cn has been filed]
Log in to the cpolar official website, click Reserve on the left, choose to reserve the second-level subdomain name, set a second-level subdomain name, click Reserve, and copy the reserved second-level subdomain name after the reservation is successful
After the reservation is successful, copy the reserved second-level subdomain address
Log in to the cpolar web UI management interface, click Tunnel Management on the left dashboard - Tunnel List, find the 3000 tunnel to be configured, and click Edit on the right
Modify the tunnel information, and configure the successfully reserved second-level subdomain name into the tunnel
- Domain name type: select a second-level subdomain name
- Sub Domain: Fill in the reserved sub-domain name
click更新
After the update is complete, open the online tunnel list, and you can see that the public network address has changed, and the address name has also become a reserved and fixed second-level subdomain name
Finally, we use a fixed public network address to access the ASP.Net.Core site, and we can see that the access is successful
You can see that the public network address has changed, and the address name has also become a reserved and fixed second-level subdomain name
[External link image transfer...(img-iJjZf9h5-1688039516163)]
Finally, we use a fixed public network address to access the ASP.Net.Core site, and we can see that the access is successful
brief introduction
"C# From Entry to Mastery (6th Edition)" starts from the beginner's point of view, through easy-to-understand language and rich and colorful examples, it introduces in detail all aspects of technology that should be mastered in WinForm application development using C#. The book is divided into 4 parts, with a total of 26 chapters, including getting to know C# and its development environment, starting the journey of C# variables and constants, expressions and operators, characters and strings, flow control statements, arrays and collections, properties and methods, Structure and classes, Windows Forms, Windows application common controls, Windows application advanced controls, data access technology, DataGridView data control, LINQ data access technology, program debugging and exception handling, advanced application of object-oriented technology, iterators and divisions Classes, generics, file and data stream technology, GDI+ graphic image technology, Windows printing technology, network programming technology, registry technology, the use of threads, and enterprise personnel management systems, etc. All the knowledge in this book is introduced in combination with specific examples, and the program codes involved are given detailed notes, which can enable readers to easily understand the essence of C# application program development, so as to quickly improve development skills.
About the Author
Tomorrow Technology, the full name is Jilin Province Tomorrow Technology Co., Ltd., is a high-tech company specializing in software development, education and training, and the integration of software development and educational resources. It also pays great attention to the ease of learning and convenience of the content and the expandability of related knowledge, which is deeply loved by readers. Its textbooks have won awards such as "Excellent Best-selling Varieties in the Industry" and "Excellent Best-selling Books from National University Presses" for many times, and many varieties have long been at the forefront of similar book sales lists.