-
Notifications
You must be signed in to change notification settings - Fork 563
Add --port option to dotnet try #246
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
Conversation
|
The approach followed above will not work in IIS. However the configuration that we have currently uses IIS express for hosted mode, hence this code path is not called in that case. |
9066f10 to
29e8433
Compare
|
|
||
| if (StartupOptions.Mode == StartupMode.Try) | ||
| { | ||
| var uri = new Uri(app.ServerFeatures.Get<IServerAddressesFeature>().Addresses.First()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can there be more than one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are setting up in the Program.cs to use a single url, there will be only one here - https://github.com/dotnet/try/pull/246/files#diff-adcfc4b0634e7250308be781cbe69f63R146
rchande
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way for us to have an ApiViaHttpTest for the auto port selection?
| command.AddOption(new Option( | ||
| "--port", | ||
| "Specify the port for dotnet try to listen on", | ||
| new Argument<int>())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
negative numbers are not valid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type should probably be ushort, since that matches the sign/max value requirements.
I have added a unit test around the part that determines the urls |
If we are in tool mode and the user has specified a port, we will use it otherwise we will launch on an available open port.
ServerFeaturesproperty to know the url at which the application is running and then launch the browser on the same when we are in the try mode.