please help - cannot access IIS from outside a VMRSS

18 replies

Last post May 16, 2019 08:55 AM by ThierryVilmart

  • please help - cannot access IIS from outside a VM

    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.

  • Re: please help - cannot access IIS from outside a VM

    May 11, 2019 02:25 PM|ThierryVilmart|LINK

    TO simplify,

    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:

    https://192.168.122.252:44306

    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.

  • Re: please help - cannot access IIS from outside a VM

    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,

    1. Before doing anything else to confuse yourself, learn about IIS site bindings and see what incoming requests they expect, https://docs.jexusmanager.com/tutorials/binding-diagnostics.html With that knowledge and some on the virtual networking, you should be able to figure out what are the right URLs to use on Linux side to send valid requests to the IIS server on Windows guest.
    2. Then the next task to learn IIS status/sub-status codes https://support.microsoft.com/en-ca/help/943891/the-http-status-code-in-iis-7-0-iis-7-5-and-iis-8-0 The more you learn there, the easier for you to tell what issue you hit and what solutions are showed by Microsoft.
    Lex Li
    https://lextudio.com
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: please help - cannot access IIS from outside a VM

    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.

  • Re: please help - cannot access IIS from outside a VM

    May 12, 2019 05:36 PM|lextm|LINK

    ThierryVilmart

    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.

    Lex Li
    https://lextudio.com
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: please help - cannot access IIS from outside a VM

    May 15, 2019 02:37 PM|ThierryVilmart|LINK

    WHy Can I not see any log in the IIS forlder for logs? I only see very empty old logs!

    I am still stuck on this.  Plaese help. I have activated the logs every hour so maybe I will be able to find logs.

    But I have tried another thing than trying to change the IP in the url only on the VM.

    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:

    "HTTP Error 403. The request URL is forbidden."

    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

    Forbidden URL.

    And in ipSecurity, I have allow unlisted, so it should allow any remote IP t o access.

  • Re: please help - cannot access IIS from outside a VM

    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:

    https://docs.microsoft.com/en-us/aspnet/visual-studio/overview/2013/aspnet-and-web-tools-20132-preview-for-visual-studio-2013-release-notes#ssl

    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.

  • Re: please help - cannot access IIS from outside a VM

    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.

  • Re: please help - cannot access IIS from outside a VM

    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.

  • Re: please help - cannot access IIS from outside a VM

    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.

  • Re: please help - cannot access IIS from outside a VM

    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.

  • Re: please help - cannot access IIS from outside a VM

    May 15, 2019 03:48 PM|ThierryVilmart|LINK

    after adding several bindings, I get a new error page from the host linux:

    <div id="header">

    Serverfel

    </div> <div id="content"> <div class="content-container">

    403 - Ej tillåtet: Åtkomst nekas.

    Du har inte behörighet att visa den här katalogen eller sidan med de autentiseringsuppgifter som angetts.

    </div> </div>
  • Re: please help - cannot access IIS from outside a VM

    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.

  • Re: please help - cannot access IIS from outside a VM

    May 15, 2019 04:57 PM|ThierryVilmart|LINK

    I found one answer, but it did not work.

    https://stackoverflow.com/questions/50485627/unable-to-run-the-mvc5-project-on-iis-server

  • Re: please help - cannot access IIS from outside a VM

    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.

    https://www.microsoft.com/sv-se/download/details.aspx?id=42642

    does somone know if it is worth installing on WIndows 10 to try?

    foun hre 4.6.2 suports it

    https://docs.microsoft.com/en-us/dotnet/framework/install/on-windows-10

  • Re: please help - cannot access IIS from outside a VM

    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.

  • Re: please help - cannot access IIS from outside a VM

    May 16, 2019 07:08 AM|ThierryVilmart|LINK

    here is says i need new windows bundles. very strange

    https://forum.radzen.com/t/error-500-19-after-delpoying-to-iis-10/329/4

    here the doc

    https://whosnailaspnetcoredocs.readthedocs.io/ko/latest/publishing/iis.html

  • Re: please help - cannot access IIS from outside a VM

    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

  • Re: please help - cannot access IIS from outside a VM

    May 16, 2019 08:55 AM|ThierryVilmart|LINK

    here

    https://docs.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/deploying-to-iis