IIS 7 and Above
please help - cannot access IIS from outside a VM
Last post May 16, 2019 08:55 AM by ThierryVilmart
May 10, 2019 06:27 PM|ThierryVilmart|LINK
I run Windows 10 inside a VM running via kvm on debian Linux.
I could fix everything, share the clipboard, mount a shared folder in a shell via cifs-tools. I use the spice-guest-tools that installed a certain number of drivers (network, I/O, etc).
BuT I am stuck to access an IIS webserver running in development inside the VM.
I enabled the port 43306 that I need in the windows firewall incoming TCP trafic.
In the Internect Information Manager, I could change the config for ipSecurity to enable the IP of my host. I added many variants.
I reached a state for which the host linux can access the server in the VM but it causes a 403 error.
If I add a binding to the IP of my VM in IIS manager, I then get a 401 error, the same error I get from both inside the VM and outside the VM.
I also had played with HTTP redirect and I could not removve it properly even though it looks removed. SO I may need to reinstall WIndows but it should be fast. And then I wil reach the error 401 step above. I also played with the anonymous authentication
and then it started to show a default IIS page that I could not remove to reac h the old state.
BUt let us assume I reinstall windows,
If I am inside the VM, on windows, the IIS server is run, and it only allows an url of the form localhost:44306. If I put the IP of the VM (the IP of windows not of linux), then I get an error not authorized with a large page. THis happens only in WIndows
in a pure WIndows and IIS world. Not really caused by being in a VM.
I created a binding for the VM IP, it changed the error page but I am still not authorized with the login information I have.
STuck on that. A binding was not enough, it still blocks the authentication. ALso I have registered the certificate of IIS inside firefox.. ANd somwehre in the IIS manager I think I could pick the righ certificate set up from and towards localhost.
May 11, 2019 02:25 PM|ThierryVilmart|LINK
ONly with IIS on WIndows, in developpment debug run. It requires to have localhost in the URL.
BUt if int the IIS manager, I create a binding to Windows IP, then I can use:
Still it will tell me in a page error 401, not authorized.
SInce I checked everything in IIS manager, it could be a sepcific functionality of windows I need to activate to make it show up in IIS manager.
OR it could be some config files stuff in the Visual studio project.
May 12, 2019 02:19 AM|lextm|LINK
You gave a lengthy description, but it does not contain enough info (like IIS configuration) for others to comment what might be wrong. So my advice is,
May 12, 2019 06:53 AM|ThierryVilmart|LINK
OK thank you. I will read mopre. But I feel stuck.
If you install visual studio and IIS from scratch, then you will only be able to use localhost:44306, not an IP. so it can be seen how to set this up on WIndows only, not to fix a complex setup.
May 12, 2019 05:36 PM|lextm|LINK
you will only be able to use localhost:44306
If you use Jexus Manager to analyze the IIS Express configuration file generated by Visual Studio, you will see what site binding was created by VS, and why it then enables localhost:44306 URL, and not IP. The more you know of site bindings, you know how
to add/change the bindings to accept requests at IP:44306 for example.
Many blog posts in fact use the same concept, such as mine https://blog.lextudio.com/how-to-let-android-emulator-access-iis-express-f6530a02b1d3 But if you
never know how site bindings work, you won't easily know why the setup looks like that.
May 15, 2019 02:37 PM|ThierryVilmart|LINK
On the host, I have mapped localhost to the ip of the VM. This allows me to skip having to reach the server using a difference domain than localhost which seems to be enrooted in IIS.
But when on the host (linux), I browse to localhost:44306, I get this error:
I could not create a binding for 44306 since it said it already exist and can override an I did not want to risk ahving to reinstall windows again. But I could change to 443 the whole IIS server. ANd I could create a binding for 443 in IIS manager. IN addition
the window firewall has a special rule HTTPS on 43 that is active by default which encouraged me to change to 443.
so now I have the same error as before using from teh host, https.//localhost:443
And in ipSecurity, I have allow unlisted, so it should allow any remote IP t o access.
May 15, 2019 03:05 PM|ThierryVilmart|LINK
The first time I used IIS, it installed certificates. So I think I need to copy the certificated from windows to my linux machine and install teh certificate in the browser. BUt this is hard for me to understand.
IIS gave me a doc link the first time it installed certificates:
see in particular the window with "Read the Security Warning" installing the certificate.
Before I reisntalled Windows, I think I could reach teh error 401 instead of 403 by installing certificates. Now I only get error 403.
I also suceeded to acces folders by individual files by enabling somewhere folder access in the IIS manager. So I really suspect teh certificate to be fixed to reach what I already had before.
I reinstalled windows because the redirect rules could not be removed and were behaving strangely.
May 15, 2019 03:13 PM|ThierryVilmart|LINK
No I think the certificate is fine. It just downloads it the first time the server is reached.
May 15, 2019 03:22 PM|ThierryVilmart|LINK
I realize now teh default web site in IIS manager is using http and my visual studio iis uses https so maybe they are not in sync at all.
May 15, 2019 03:28 PM|ThierryVilmart|LINK
I think something useful I did in the IIS manager is to add a binding on the https port 443. But I cannot do it for my development server since it does not show up in the IIS manager.
the default web site is pointing to another folder path and is never started.
So maybe you can clarify this for me.
I tried to make the default web site point to my visual studio project folder but it did not work.
May 15, 2019 03:35 PM|ThierryVilmart|LINK
I could change the path for the default website to where visual studio builds in a sub fodler /obj/Debug
now I can start the server from IIS maanger and it works on the VM.
But it cannot be reached from the host linux.
BUt now I know the config in IIS manager applies. So I am a little closer to a solution.
May 15, 2019 03:48 PM|ThierryVilmart|LINK
after adding several bindings, I get a new error page from the host linux:
May 15, 2019 04:22 PM|ThierryVilmart|LINK
I remove dthe IP binding for the top element in IIS.
NOw the website can only reach by folder browsing, it does not run the server any more. Very strange. Cant set it back.
IT should not be needed to reinstall IIS. There must be a way. cant find the doc for this.
Or maybe my visual studio was running the server and got confused. But that surprizes me. I thought it was started in IIS manager.
May 15, 2019 04:57 PM|ThierryVilmart|LINK
I found one answer, but it did not work.
May 15, 2019 05:35 PM|ThierryVilmart|LINK
My guess is that IIS manager does not have the libraries and stuff to run my MVC application .NET 4.5.2. In a strange way it does not pick it in a natural way. I activated the windows functionalities.
Maybe I need to install .NET 4.5.2 separately on Windows. Any advice about this?
ths installer does not support windows 10.
does somone know if it is worth installing on WIndows 10 to try?
foun hre 4.6.2 suports it
May 16, 2019 06:53 AM|ThierryVilmart|LINK
I progressed. Now I found I have to use publish in visual studio.
Now I am stuck on error 500.19, web.config invalid
but I could validate it using an online validator.
May 16, 2019 07:08 AM|ThierryVilmart|LINK
here is says i need new windows bundles. very strange
here the doc
May 16, 2019 08:38 AM|ThierryVilmart|LINK
I don't understand the doc because there is no public static void Main where I can put the IIS integration commande. I have an MVC app. But I did install the server bundle thing.
And I do not have a project.json to add the iis-tools
May 16, 2019 08:55 AM|ThierryVilmart|LINK