Skip to content

StaticFileMiddlewareTests should use dynamic ports #3063

@mikeharder

Description

@mikeharder

StaticFileMiddlewareTests should use dynamic ports rather than hardcoding port 12345. For ServerType.Kestrel, the app should bind to dynamic port "0" and query the app to find the assigned port, since this is 100% reliable. For ServerType.WebListener, the app should use GetNextPort() which is less reliable than directly binding to "0", but should be more reliable than a hardcoded port.

https://github.com/aspnet/StaticFiles/blob/5d2b1000f19dc3e892611f387b46cd519976a9f0/test/Microsoft.AspNetCore.StaticFiles.FunctionalTests/StaticFileMiddlewareTests.cs#L181

Metadata

Metadata

Assignees

Labels

area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresfeature-static-files

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions