diff --git a/src/Servers/IIS/IIS/src/Core/IISHttpServer.cs b/src/Servers/IIS/IIS/src/Core/IISHttpServer.cs index 68a634ebb21e..6abaa5b2c0db 100644 --- a/src/Servers/IIS/IIS/src/Core/IISHttpServer.cs +++ b/src/Servers/IIS/IIS/src/Core/IISHttpServer.cs @@ -28,7 +28,7 @@ internal sealed class IISHttpServer : IServer private readonly IISServerOptions _options; private readonly IISNativeApplication _nativeApplication; private readonly ServerAddressesFeature _serverAddressesFeature; - private readonly string? _virtualPath; + private string? _virtualPath; private readonly TaskCompletionSource _shutdownSignal = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); private bool? _websocketAvailable; @@ -69,8 +69,6 @@ ILogger logger _logger = logger; _options = options.Value; _serverAddressesFeature = new ServerAddressesFeature(); - var iisConfigData = NativeMethods.HttpGetApplicationProperties(); - _virtualPath = iisConfigData.pwzVirtualApplicationPath; if (_options.ForwardWindowsAuthentication) { @@ -106,6 +104,9 @@ public unsafe Task StartAsync(IHttpApplication application, (IntPtr)_httpServerHandle, (IntPtr)_httpServerHandle); + var iisConfigData = NativeMethods.HttpGetApplicationProperties(); + _virtualPath = iisConfigData.pwzVirtualApplicationPath; + _serverAddressesFeature.Addresses = _options.ServerAddresses; return Task.CompletedTask; diff --git a/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/InProcess/AppOfflineIISExpressTests.cs b/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/InProcess/AppOfflineIISExpressTests.cs index 6bc3892713a4..db38cdf0ccb3 100644 --- a/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/InProcess/AppOfflineIISExpressTests.cs +++ b/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/InProcess/AppOfflineIISExpressTests.cs @@ -19,6 +19,7 @@ public AppOfflineIISExpressTests(PublishedSitesFixture fixture) : base(fixture) } [ConditionalFact] + [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/60482")] public async Task AppOfflineDroppedWhileSiteStarting_SiteShutsDown_InProcess() { // This test often hits a race between debug logging and stdout redirection closing the handle @@ -55,8 +56,8 @@ public async Task AppOfflineDroppedWhileSiteStarting_SiteShutsDown_InProcess() { // For IISExpress, we need to catch the exception because IISExpress will not restart a process if it crashed. // RemoveAppOffline will fail due to a bad request exception as the server is down. - Assert.Contains(TestSink.Writes, context => context.Message.Contains("Drained all requests, notifying managed.")); deploymentResult.AssertWorkerProcessStop(); + Assert.Contains(TestSink.Writes, context => context.Message.Contains("Drained all requests, notifying managed.")); return; } }