Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

C # Web application debugging enables external access

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

A sore point when developing Web applications with C # is that the external machines cannot access the Web application when the native VS is used to open the Web application debugging. Here will describe how to set up to allow local area network and extranet machines to access local Web applications.

Catalogue

1. Set private network access

two。 Set public network access

1. Set private network access

Before setting up, the native environment is as follows:

Operating system: win7

IDE:Visual Studio 2010

Application: ASP.net

To enable other machines in the local area network to access native web applications involves the following 4 steps:

Step 1: set the startup mode to IIS Express

When Visual Studio runs Web applications, it defaults to its own Visual Studio development server. So first change the project to use the IIS Web server.

First of all, make sure that the machine has been installed with IIS Express, download address (version 10.0): https://www.microsoft.com/zh-CN/download/details.aspx?id=48264

Step: right-click the Web project → properties → Web tab → check to use the local IIS Web server → to set the port and click the [create Virtual Directory] button

Step 2: set up the applicationhost.config file for IIS Express

After clicking the "create Virtual Directory" button above, the virtual directory information will be created in the applicationhost.config file of IIS Express.

File default path:% userprofile%\ My Documents\ IISExpress\ config\ applicationhost.config

Find the configuration information for the above application and add one:

one

Example diagram:

Note: if IIS Express has been started before modification, you need to restart IIS Express before modification.

Step 3: set up the windows firewall

After completing the above 2 steps, you also need to set up a firewall to allow this port to pass through.

1) graphic operation:

Turn on the advanced settings of Windows Firewall:

① Control Panel → Windows Firewall → Advanced Settings

② creates an inbound rule: protocol TCP, port 8081.

Example diagram:

2) Command Line

You can also add an inbound rule by executing the following command:

1netsh advfirewall firewall Add rule name=\ "Command Line Web access 8081\" dir=in protocol=tcp localport=8081 action=allow

Results:

Step 4: configure URL retention items

In Windows 7, you can use the Netsh.exe tool to configure HTTP settings that allow you to specify URL passes.

Run the cmd command as an administrator:

1netsh http add urlacl url= http://*:8081/ user=everyone

This command adds a URL reservation for the specified URL namespace for all accounts

For more netsh information, visit MSDN: configuring HTTP and HTTPS

Operation diagram

two。 Set public network access

After the private network is set to be accessible, partners who want to access the public network can access the machine in the following two ways:

1) Port mapping

2) Intranet penetration

2.1 Port Mapping

Prerequisite: have permission to set up the router.

Set a port mapping rule in the external router to jump to the local area network machine when accessing the external IP address. The specific operation is not described here.

2.2 Intranet penetration

When developing web applications within the company, not everyone can apply for port mapping permission, so it is time to have an intranet penetration solution.

There are many applications on the network that provide intranet penetration, using peanut shells (official website: http://hsk.oray.com/).

Example:

Note: the port number will be added when Wechat OAuth3.0 redirects the domain name. In this case, the domain name port is 80, the local port is 8081, and the redirected address is domain name: 8081. An error will be displayed. The solution only needs to set the port of the native web application to 80.

Operation diagram

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report