NS_ERROR_CONNECTION_REFUSED while navigating to localhost:8000 in Playwright on Azure pipeline
17:37 14 Feb 2023

I am currently trying to get some Playwright unit tests in a .NET solution on a Azure pipeline. The tests all run locally on my machine. However on in the Azure pipeline, the tests fail.

Within the test assembly, it successfully register localhost:8000

Starting IIS Express ... Successfully registered URL "http://localhost:8000/" for site "Development Web Site" application "/" Registration completed IIS Express is running.

However, when it tries to access the url for a unit test I get the following exception thrown by Playwright

Microsoft.Playwright.PlaywrightException: NS_ERROR_CONNECTION_REFUSED =========================== logs =========================== navigating to "http://localhost:8000/Operations/Home", waiting until "load" ============================================================

Stack Trace: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Playwright.Transport.Connection.d__341.MoveNext() in /_/src/Playwright/Transport/Connection.cs:line 143 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Playwright.Transport.Connection.d__441.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Playwright.Core.Frame.d__91.MoveNext() in /_/src/Playwright/Core/Frame.cs:line 547 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Company.UITest.Account.SemanticsAnalyticsTest.d__2.MoveNext() in D:\a\93\s\Main\Company.UITest\Account\SemanticsAnalyticsTest.cs:line 65 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Company.UITest.Account.SemanticsAnalyticsTest.d__2.MoveNext() in D:\a\93\s\Main\Company.UITest\Account\SemanticsAnalyticsTest.cs:line 78 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.ThreadOperations.ExecuteWithAbortSafety(Action action) Standard Output Messages: C:\Program Files\IIS Express\iisexpress.exe /path:"D:\a\93\s\Main\Company" /port:8000

Tried the URL as google.com Tried localhost:8000 with http and https Tried http://localhost:8000/Operations/Home

Expected homepage to load and the test to confirm that the url was reached

.net azure azure-pipelines localhost playwright