Skip to content

AutobahnTester should use dynamic port "0" with Kestrel #3062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mikeharder opened this issue Apr 16, 2018 · 0 comments
Closed

AutobahnTester should use dynamic port "0" with Kestrel #3062

mikeharder opened this issue Apr 16, 2018 · 0 comments
Assignees
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions feature-websockets Includes: WebSockets
Milestone

Comments

@mikeharder
Copy link
Contributor

mikeharder commented Apr 16, 2018

Changes should be made to AutobahnTester and/or SelfHostDeployer to use dynamic port "0" for ServerType.Kestrel. Currently, it uses the less-reliable GetNextPort() method.

This is somewhat complicated since AutobahnTester requires HTTPS, which is currently only supported in SelfHostDeployer when DeploymentParameters.ApplicationBaseUriHint is set, but dynamic port "0" is only used when ApplicationBaseUriHint is not set. So, there are two options (in my order of preference):

  1. Add an Ssl parameter to DeploymentParameters, then change AutobahnTester to set DeploymentParameters.Ssl instead of DeploymentParameters.ApplicationBaseUriHint. This will use dynamic port "0" for ServerType.Kestrel (both HTTP and HTTPS), and GetNextPort() for ServerType.WebListener (since dynamic port "0" is not supported).

  2. Change SelfHostDeployer to use dynamic port "0" when ApplicationBaseUriHint 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 change AutobahnTester 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

@mikeharder mikeharder added the feature-websockets Includes: WebSockets label Apr 16, 2018
@mikeharder mikeharder added this to the 2.2.0-mq milestone Apr 16, 2018
@mikeharder mikeharder self-assigned this Apr 16, 2018
mikeharder added a commit to aspnet/WebSockets that referenced this issue Apr 18, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions feature-websockets Includes: WebSockets
Projects
None yet
Development

No branches or pull requests

3 participants