Search code examples
asp.net-corekestrel

asp.net Core 3.1 Webapp unable to bind to localhost


i have an issue starting my asp.net core webapp with the profile "WebApp". i allways get:

"System.IO.IOException" in System.Private.CoreLib.dll Ein Ausnahmefehler des Typs "System.IO.IOException" ist in System.Private.CoreLib.dll aufgetreten. Failed to bind to address https://localhost:5000.

The port is not used by any other programm. I tried lots of different ports as well.

Does anybody has an idea what i can try? On my colleagues Pc it works just fine.

Seems it does not have the right to bind to any ports.

Startup:

   public static void Main(string[] args)
       {
           CreateWebHostBuilder(args).Build().Run();
       }

launchsettings.

     "iisSettings": {
         "windowsAuthentication": false,
         "anonymousAuthentication": true,
         "iisExpress": {
             "applicationUrl": "http://localhost:23736",
             "sslPort": 44369
         }
     },
     "profiles": {
         "IIS Express": {
             "commandName": "IISExpress",
             "launchBrowser": true,
             "environmentVariables": {
                 "ASPNETCORE_ENVIRONMENT": "Development"
             }
         },
         "WebApp": {
             "commandName": "Project",
             "launchBrowser": true,
             "applicationUrl": "http://localhost:5000",
             "environmentVariables": {
                 "ASPNETCORE_ENVIRONMENT": "Development"
             }
         }
     }
 }```

IIS Profile works fine for me..

Would be very glad if one could help. trying for few days now.

Solution

  • I solved it. It was because the project was not located on my C-Drive but on a network drive from my company.

    After moving it to the C drive it worked.