1

My question is similar to this, except that I don't use Docker.

My Setup

  • ASP.NET Core 3.1 MVC
  • Ubuntu 18.04.4 LTS

launchsettings.json

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:64056",
      "sslPort": 44375
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "MyProject": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "https://0.0.0.0:5001;http://0.0.0.0:5000"
    }
  }
}

The Goal

  • I am trying to launch the app on the server and then open an ssh tunnel to it like this, so that I can access the webpage from the browser to test it
    ssh -L5000:127.0.0.1:5000 -L5001:127.0.0.1:5001 myserver.de
    

The Problem

The project builds fine on the server, but when I launch it, I get this:

warn: Microsoft.AspNetCore.Server.Kestrel[0]
      Unable to bind to http://localhost:5000 on the IPv6 loopback interface: 'Address family not supported by protocol'.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
      Unable to bind to https://localhost:5001 on the IPv6 loopback interface: 'Address family not supported by protocol'.
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /home/user/MyProject/MyProject/bin/Release/netcoreapp3.1

I tried to ping it from the server with curl, and it responds with the correct HTML view.

curl -k -X GET "https://localhost:5001/account/login"

But, testing a web app with curl is overkill, then when I try to access it from dev machine from the browser, It can't reach the server, although I established the tunnel successfully. That's what I get in the browser:


enter image description here


Also, I configured Kestrel to accept request from any Ip, but when I run netstat -alnp | grep 5000, It says It listens from localhost only:

tcp        0      0 127.0.0.1:5000          0.0.0.0:*               LISTEN      27289/dotnet

What could be the problem and how to solve it?

Gicu Mironica
  • 585
  • 8
  • 22
  • I don't think those warnings are your problem - see [this issue](https://github.com/aspnet/IISIntegration/issues/239) - as the warning you're getting looks like a certificate error. – stuartd Jul 03 '20 at 11:58
  • 1
    This is a certificate error , certificate validation happens different ways in different browsers \tools ; That could be the reason curl is working and browser is not , check the certificate used , try to use different browsers , Your .NET startup looks absolutely fine. – Shan Sunny Jul 03 '20 at 12:05
  • @ShanSunny tried every existing browser, probably thats the certificate then – Gicu Mironica Jul 03 '20 at 12:06

0 Answers0