简体   繁体   English

在Azure VM上远程访问IIS Express托管的网站

[英]Accessing IIS Express hosted website remotely on Azure VM

I have Visual Studio solution running in Debug mode using IIS Express on an Azure Virtual Machine. 我在Azure虚拟机上使用IIS Express以调试模式运行Visual Studio解决方案。

I can RDP into this machine using its domain: 我可以使用其域将RDP放入这台机器:

myapp.cloudapp.net:port# myapp.cloudapp.net:端口#

IIS Express is running: IIS Express正在运行:

localhost:2799 本地主机:2799

I have also created an End Point using HTTP, mapping public port 80 to 2799. 我还使用HTTP创建了一个端点,将公共端口80映射到2799。

But the URL http://myapp.cloudapp.net does not connect or relay through to the webpage running at localhost:2799. 但是URL http://myapp.cloudapp.net不会连接或中继到在localhost:2799运行的网页。 Is there something else that needs to be done to make this happen? 要做到这一点,还有别的事情要做吗?

I believe that the only thing you need to modify - is to add new rule in your firewall to open port 2799. Try to disable firewall and check whether the website available. 我认为您唯一需要修改的-是在防火墙中添加新规则以打开端口2799。尝试禁用防火墙并检查网站是否可用。 If the page is shown - add appropriate rules to firewall. 如果显示页面-将适当的规则添加到防火墙。

There are three changes you might need to make. 您可能需要进行三项更改。

1.Tell IIS Express itself to bind to all ip addresses and hostnames. 1.告诉IIS Express本身绑定到所有IP地址和主机名。 In your .config file (typically %userprofile%\\My Documents\\IISExpress\\config\\applicationhost.config, or $(solutionDir).vs\\config\\applicationhost.config for Visual Studio 2015), find your site's binding element, and add : 在您的.config文件中(通常为%userprofile%\\ My Documents \\ IISExpress \\ config \\ applicationhost.config或Visual Studio 2015的$(solutionDir).vs \\ config \\ applicationhost.config),找到您网站的绑定元素,然后添加:

   <binding protocol="http" bindingInformation="*:2799:*" />

2. Setup the bit of Windows called 'http.sys'. 2.设置Windows的“ http.sys”位。 As an administrator, run the command: 以管理员身份,运行以下命令:

   netsh http add urlacl url=http://*:2799/ user=everyone
  1. Allow IIS Express through Windows firewall. 允许IIS Express通过Windows防火墙。 Start / Windows Firewall with Advanced Security / Inbound Rules / New Rule... Program %ProgramFiles%\\IIS Express\\iisexpress.exe OR Port 2799 TCP 开始/具有高级安全性的Windows防火墙/入站规则/新规则...程序%Pro​​gramFiles%\\ IIS Express \\ iisexpress.exe或端口2799 TCP

Now when you start iisexpress.exe you should see a message such as 现在,当您启动iisexpress.exe时,应该会看到一条消息,例如

Successfully registered URL "http://*:2799/" for site "myapp" application "/" 

This configuration combined with your endpoint mapping should do the trick Hope this helps Best regards Stéphane 将此配置与端点映射结合起来应该可以解决问题,希望这对您有所帮助Stéphane

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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