这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@akshita31
Copy link
Contributor

@akshita31 akshita31 commented May 30, 2019

  1. In the Program.cs, based on if we are in tool mode or not we decide the url that will be used.
    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.
  2. In the Startup.cs we use the ServerFeatures property 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.

@akshita31
Copy link
Contributor Author

akshita31 commented May 30, 2019

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.

aspnet/Hosting#811

@akshita31 akshita31 force-pushed the allow_port branch 2 times, most recently from 9066f10 to 29e8433 Compare May 31, 2019 00:03
@akshita31
Copy link
Contributor Author

image


if (StartupOptions.Mode == StartupMode.Try)
{
var uri = new Uri(app.ServerFeatures.Get<IServerAddressesFeature>().Addresses.First());
Copy link
Contributor

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?

Copy link
Contributor Author

@akshita31 akshita31 Jun 3, 2019

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

Copy link

@rchande rchande left a 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>()));
Copy link
Member

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

Copy link

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.

@akshita31
Copy link
Contributor Author

Is there a way for us to have an ApiViaHttpTest for the auto port selection?

I have added a unit test around the part that determines the urls

@colombod colombod merged commit 31137a9 into dotnet:master Jun 6, 2019
@akshita31 akshita31 deleted the allow_port branch June 6, 2019 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants