4

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:

enter image description here

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:

enter image description here

Egidi
  • 1,736
  • 8
  • 43
  • 69
  • Firewall properly is not the issue as the error page shown in screenshot is from IIS. This seems like IIS configuration issue. Maybe in IIS, your site is bind to localhost(127.0.0.1) only. – John Siu Sep 13 '16 at 17:20
  • I don't think that is the issue beacuse I can see /node from outside... – Egidi Sep 14 '16 at 16:59
  • Important edition done in OP – Egidi Sep 14 '16 at 17:27
  • Add your external IP to your website binding. (https://technet.microsoft.com/en-us/library/bb734869.aspx ). If this works then I put it into an answer. – John Siu Sep 14 '16 at 17:34
  • No. It is IIS website configuration binding, the link have detail instructions. – John Siu Sep 14 '16 at 17:41
  • @JohnSiu thanks for your help but I can't make it work. In the website's binding i already have a binding for all IPs to iisnode.local. Please see the OP with the screenshot. If I add another rule with the external IP of the server nothing changes – Egidi Sep 14 '16 at 17:55
  • Add a new binding, same as the one you currently have, but leave the hostname empty, and use external IP. – John Siu Sep 14 '16 at 18:04
  • @JohnSiu done, nothing changes... – Egidi Sep 14 '16 at 18:09
  • I have to say that http:\\iisnode.local only works in the server too if there is a rule in server's hosts file with 127.0.0.1 iisnode.local – Egidi Sep 14 '16 at 18:16
  • the iisnode.local will only work in the server, that is normal. – John Siu Sep 14 '16 at 18:19
  • You may have to disable or delete your default site for the IP only rules to work. – John Siu Sep 14 '16 at 18:20
  • OMG, I re-read your question, your site is actually working!!! – John Siu Sep 14 '16 at 18:25
  • @JohnSiu yes, but only accesible from outside if I add iisnode.local rule to my personal computer's hosts file – Egidi Sep 14 '16 at 18:27
  • Answer created. – John Siu Sep 14 '16 at 18:36

1 Answers1

3

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.

John Siu
  • 5,056
  • 2
  • 26
  • 47
  • thanks for your help! I just needed to create and A rule in my domains DNS config. Thanks!!! – Egidi Sep 14 '16 at 18:48
  • @Egidi, what did you do? I have the exact same problem and found this post helpful. I can now access the site using issnode.local by having this in my hosts file. How did you edit your DNS to fix this? – Some_Dude Aug 21 '18 at 14:05