I can't access my website from outside Windows Server 2012 using IIS and IISNode

怎甘沉沦 提交于 2019-12-23 12:01:30

问题


I bought a new dedicated server. I have a MEAN Stack application (Node.js, Angular, MongoDB, Express) and wanted to take advantage of using IIS to publish my webapp.

I followed this guide to install iisnode and make a litle node.js server working.

I did it and succesfully tried http://iisnode.local in my browser inside the server.

Ont he other hand, if I try http://(theIPoftheserver)/iisnode.local am I am getting the following error:

I need to do something for the server to be accesible from outside but I don't know what..

If i go to http://(theIPoftheserver)/ I can see IIS website and even if I go to http://(theIPoftheserver)/node I can see the iisnode website...

I am quite newbie and I need some help...

My web.config file:

<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>

EDIT: I also have to mention that I have a new rule in windows' hosts file as follows:

127.0.0.1   iisnode.local

EDIT2: can windows firewall be blocking something? Do I need to disconnect it?

IMPORTANT EDIT 14.09.2016: if I edit hosts file and add:

<server-ip-address> iisnode.local

And then I the I visit http://iisnode.local it works! I don't understand it very well why though.. i don't want all the users of my website to modify their hosts file, what can I do?

I don't know is this could be the source of the problem?

EDIT: My Website bindings look like this:


回答1:


When you access your site within the server with

http://iisnode.local (by hostname)

It is same as

http://127.0.0.1/ (by IP)

So when you use IP address, you don't put iisnode.local after it.

iisnode.local is hostname, in an URL, you either use hostname OR IP, not the same time.

http://(theIPoftheserver)/iisnode.local

is equal to

http://(IP)/(hostname) <--- That is wrong!

Currently, I am assuming you don't have public dns setup for your server, the correct way to access the site will be

http://(External-IP)/ <-- No iisnode.local after it.



来源:https://stackoverflow.com/questions/39418811/i-cant-access-my-website-from-outside-windows-server-2012-using-iis-and-iisnode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!