我无法使用 IIS 和 IISNode 从外部 Windows Server 2012 访问我的网站
I can't access my website from outside Windows Server 2012 using IIS and IISNode
我买了一个新的独立服务器。我有一个 MEAN Stack 应用程序(Node.js、Angular、MongoDB、Express)并想利用 IIS 来发布我的 Web 应用程序。
我按照 this guide 安装了 iisnode 并使 node.js 服务器正常工作。
我做到了,并在我的服务器内的浏览器中成功尝试了http://iisnode.local。
另一方面,如果我尝试 http://(theIPoftheserver)/iisnode.local 我会收到以下错误:
我需要做一些事情让服务器可以从外面访问,但我不知道是什么..
如果我去 http://(theIPoftheserver)/ I can see IIS website and even if I go to http://(theIPoftheserver)/node 我可以看到 iisnode 网站...
我是新手,需要一些帮助...
我的 web.config 文件:
<configuration>
<system.webServer>
<!-- indicates that the server.js file is a node.js application
to be handled by the iisnode module -->
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="sendToNode">
<match url="/*" />
<action type="Rewrite" url="server.js" />
</rule>
</rules>
</rewrite>
<iisnode enableXFF="true" />
</system.webServer>
</configuration>
编辑:我还必须提到我在 windows' hosts 文件中有一个新规则如下:
127.0.0.1 iisnode.local
EDIT2:windows 防火墙可以阻止某些东西吗?我需要断开连接吗?
重要编辑 14.09.2016:如果我编辑主机文件并添加:
<server-ip-address> iisnode.local
然后我访问 http://iisnode.local 它成功了!
我不是很明白为什么……我不想让我网站的所有用户都修改他们的主机文件,我该怎么办?
我不知道这可能是问题的根源吗?
编辑:我的网站绑定如下所示:
当您使用
在服务器中访问您的站点时
http://iisnode.local (by hostname)
同
http://127.0.0.1/ (by IP)
所以当你使用IP地址时,不要在它后面加上iisnode.local。
iisnode.local 是主机名,在 URL 中,您可以同时使用主机名或 IP。
等于
http://(IP)/(hostname) <--- That is wrong!
目前,我假设您没有为您的服务器设置 public dns,访问该站点的正确方法是
http://(External-IP)/ <-- No iisnode.local after it.
我买了一个新的独立服务器。我有一个 MEAN Stack 应用程序(Node.js、Angular、MongoDB、Express)并想利用 IIS 来发布我的 Web 应用程序。
我按照 this guide 安装了 iisnode 并使 node.js 服务器正常工作。
我做到了,并在我的服务器内的浏览器中成功尝试了http://iisnode.local。
另一方面,如果我尝试 http://(theIPoftheserver)/iisnode.local 我会收到以下错误:
我需要做一些事情让服务器可以从外面访问,但我不知道是什么..
如果我去 http://(theIPoftheserver)/ I can see IIS website and even if I go to http://(theIPoftheserver)/node 我可以看到 iisnode 网站...
我是新手,需要一些帮助...
我的 web.config 文件:
<configuration>
<system.webServer>
<!-- indicates that the server.js file is a node.js application
to be handled by the iisnode module -->
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="sendToNode">
<match url="/*" />
<action type="Rewrite" url="server.js" />
</rule>
</rules>
</rewrite>
<iisnode enableXFF="true" />
</system.webServer>
</configuration>
编辑:我还必须提到我在 windows' hosts 文件中有一个新规则如下:
127.0.0.1 iisnode.local
EDIT2:windows 防火墙可以阻止某些东西吗?我需要断开连接吗?
重要编辑 14.09.2016:如果我编辑主机文件并添加:
<server-ip-address> iisnode.local
然后我访问 http://iisnode.local 它成功了! 我不是很明白为什么……我不想让我网站的所有用户都修改他们的主机文件,我该怎么办?
我不知道这可能是问题的根源吗?
编辑:我的网站绑定如下所示:
当您使用
在服务器中访问您的站点时http://iisnode.local (by hostname)
同
http://127.0.0.1/ (by IP)
所以当你使用IP地址时,不要在它后面加上iisnode.local。
iisnode.local 是主机名,在 URL 中,您可以同时使用主机名或 IP。
等于
http://(IP)/(hostname) <--- That is wrong!
目前,我假设您没有为您的服务器设置 public dns,访问该站点的正确方法是
http://(External-IP)/ <-- No iisnode.local after it.