Why do I get a 403 when hitting a localhost iisexpress site hosted on a VM
Asked Answered
W

0

8

So before I start, I know how to open up IISExpress to the network, there's plenty of articles about this, I even wrote one. However, these approaches do have limitations - most notably the need to add bindings which I've found to be hit-or-miss and worse, breaks any code that does things based on hostname.

I am on OsX running Windows 10 inside of Parallels and earlier this week I thought I should try to get localhost forwarded into the VM in the same way that I can do with docker containers.

I got really close, but I cannot figure out the last step. Here is what I did and what I am seeing:

  1. I temporarily disabled my firewall on Windows
  2. I forwarded the correct port (44300 in this case) to the guest VM and rebooted it.
  3. I ran iisexpress through the command line so that I can see the full log (I tried through visual studio as well)

What I'm seeing is that when I hit localhost:44300 from inside the VM, my site loads fine and all sorts of things are logged.

But when I hit it from the host I'm getting

HTTP Error 403. The request URL is forbidden.

There is nothing logged by iisexpress in this scenario.

However, I know that the request is in some manner getting through since if I stop iisexpress and head to localhost:44300 again on the host, I get the standard

localhost refused to connect. ERR_CONNECTION_REFUSED

The fact that iisexpress is or is not listening on that port is cascading up to the host VM therefore, but nothing else is getting through.

So I'm a bit at a loss - it almost looks kinda like a binding thing, but as far as iisexpress knows, due to the port forwarding, wouldn't this request be coming from localhost? How can it tell if it is not? Even that sounds unlikely due to the lack of log messages. Also I never see anything pop up in fiddler.

What I wonder instead if there might be some yet other windows component that sees something bound to 44300, sees an request coming over the network stack, and shuts it down. Is that a thing?

We answered 10/12, 2018 at 22:59 Comment(6)
With a tool like Jexus Manager docs.jexusmanager.com, you should be able to enable Failed Request Tracing and IIS logs to see what 403 you get exactly, support.microsoft.com/en-ca/help/943891/…Leuko
@LexLi the question is about iis expressWe
What makes you feel that I was not talking about IIS Express?Leuko
Just that the comment specifically mentioned IIS and so did the article. I'll check out how it might work with iisexpressWe
It is not "might" but "must". Microsoft fails to update the docs, though.Leuko
Well that was pointless. After downloading the mis and running the installer for Jesus, I get an app that doesn't run and Windows doesn't know how to open it.Womanhood

© 2022 - 2024 — McMap. All rights reserved.