Unable to launch IIS Express Web server

Richard Rosenheim 46 Reputation points
2023-03-21T19:23:22.15+00:00

I copied a Visual Studio 2022 ASP.NET MVC project that I was working on from my desktop machine to my laptop. When I attempted to test/run the app in debug mode from within Visual Studio 2022, I got an "Unable to launch the IIS Express Web server" error with the following details:

Output from IIS: Failed to to register URL "http://192.168.0.104:24995/" for site "MyWebApp" application "/". Error description: Access is denied. (0x80070005)

The IP address shown (192.168.0.104), is that of my desktop system, not of my laptop. Yet, when I did a text search for that IP address, I was unable to find it anywhere in any of the project files.

Can someone please either point me to where that IP address would be store, or provide instructions on how to clear out that value?

TIA,

Richard

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,252 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Lan Huang-MSFT 25,471 Reputation points Microsoft Vendor
    2023-03-22T02:59:06.7+00:00

    Hi @Richard Rosenheim ,

    You can try the following two methods:

    The first:

    1. In Solution Explorer, right-click the name of the web application and select Properties. Click the Web tab.
    2. In the Servers section, under dropdown selection for IIS Express, change the port number in the Project URL box.
    3. To the right of the Project URL box, click Create Virtual Directory, and then click OK.
    4. Save your changes, either by CTRL+S or clicking Save Selected Items that you will find in the File-menu.

    User's image

    The second:

    1. Right click on project select Unload project
    2. Again Right click and select Edit ProjectName.csproj
    3. Remove these 3 lines <DevelopmentServerPort>0</DevelopmentServerPort> <DevelopmentServerVPath>/</DevelopmentServerVPath> <IISUrl>http://localhost:62940/</IISUrl>
    4. Save and reload the project, and you are good to go.

    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  2. Georg Aubele Lehmbau 0 Reputation points
    2024-03-07T11:21:01.25+00:00

    I have an almost identical problem, but I'm developing an Web API and therefore

    • solution 1 (I dont have a web pane in my properties) and
    • solution 2 (the csproj-file is very short and has not the above mentioned lines about <IISUrl> do not exist.

    Can anyone help me out? It's really annoying.
    It startet as I changed the IP from localhost to an IP in my network for the IIS section in the launchSettings.json once to test something, but did not vanish as I changed it back to localhost.

    I already tried to delete all the files and folders in %USERPROFILE%\AppData\Local\Temp\IISExpress\.

    0 comments No comments