Something in our CI setup server script when installing dotnet.exe set a firewall rule to blocked. Never seen something like this but once discovered we were able to turn that off and fix it.
Trouble connecting to .net core 6 api port on Windows VM with NGS rules working
We are having trouble getting asp net core 6 web api functioning on a Windows 10 Pro VM. The only error we get is the port is not discoverable with tools like "canyouseeme .org" and a timeout in web browsers.
We've minimized the asp net core application test to just the default WeatherForcast from VisualStudio 2022 asp net web api template to eliminate any setup issues in our code. (Only change is enabling swagger and swagger routing)
We have a public IP (ip4), we have the OS firewalls and NGS ports opened for our required port (5000 and a few others which we have tested), we are running via http for initial connectivity testing, we are inheriting DNS. We are not running IIS currently.
We can run the app on our local ip and with wildcard 0.0.0.0 or *. We can see it on the VM running perfectly fine, but externally with the public IP we cannot establish a connection on port 5000
BUT to confirm NGS ports are opened to the public IP, when running the below powershell script (in powershell 5) we can get an html response of test.html (simple hello world test) on port 5000 so I think we should be safe to assume it is not an issue with firewalls or NGS. We can connect running the localIP or wildcard * with the below script. CanYouSeeMe .org also shows it can now see the port.
write-host "killing previous session, please wait..." -nonewline
$httplistener = new-object system.net.httplistener
$httplistener.stop();
$httplistener.close();
start-sleep -seconds 5
write-host " DONE (I hope)"
$httpListener = New-Object System.Net.HttpListener
$httpListener.Prefixes.Add("http://*:5000/")
#$httpListener.Prefixes.Add("http://{local_IP_here}:5000/")
$httpListener.Start()
write-host "Listening..."
do {
$context = $httpListener.GetContext()
$context.Response.StatusCode = 200
$context.Response.ContentType = 'text/HTML'
$WebContent = Get-Content -Path "C:\fusion\scott\test.html" -Encoding UTF8
$EncodingWebContent = [Text.Encoding]::UTF8.GetBytes($WebContent)
$context.Response.OutputStream.Write($EncodingWebContent , 0, $EncodingWebContent.Length)
$context.Response.Close()
Write-Host "." -NoNewLine
} until ([System.Console]::KeyAvailable)
$httpListener.Close()
In both hosting cases netstat -ano
shows it hosting on both IP4 and IP6
I'm not even sure how to continue debugging this as for how I understand this it should just be connecting to my api. Do I require some reverse proxy or some hidden setting the virtual network? Is it a user role launching role in the VM?