AutobahnTester should use dynamic port "0" with Kestrel #3062
Labels
area-networking
Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
feature-websockets
Includes: WebSockets
Milestone
Changes should be made to
AutobahnTester
and/orSelfHostDeployer
to use dynamic port "0" forServerType.Kestrel
. Currently, it uses the less-reliableGetNextPort()
method.This is somewhat complicated since
AutobahnTester
requires HTTPS, which is currently only supported inSelfHostDeployer
whenDeploymentParameters.ApplicationBaseUriHint
is set, but dynamic port "0" is only used whenApplicationBaseUriHint
is not set. So, there are two options (in my order of preference):Add an
Ssl
parameter toDeploymentParameters
, then changeAutobahnTester
to setDeploymentParameters.Ssl
instead ofDeploymentParameters.ApplicationBaseUriHint
. This will use dynamic port "0" for ServerType.Kestrel (both HTTP and HTTPS), andGetNextPort()
for ServerType.WebListener (since dynamic port "0" is not supported).Change
SelfHostDeployer
to use dynamic port "0" whenApplicationBaseUriHint
is set to either "127.0.0.1:0" or "[::1]:0". Dynamic port "0" is not supported on other hostnames which try to bind both IPv4 and IPv6, like "localhost". Then changeAutobahnTester
to use "http[s]://127.0.0.1:0" instead of "http[s]://localhost:0".https://github.com/aspnet/WebSockets/blob/612db427725b3bdac3d6851288c93051bfe69621/test/Microsoft.AspNetCore.WebSockets.ConformanceTest/Autobahn/AutobahnTester.cs#L132
Related: aspnet/Hosting#1296
The text was updated successfully, but these errors were encountered: