How to specify a base url or host port for Jetbrains Rider asp.net project
This can be done inside the Rider IDE if you like.
If you edit the run/build configuration you are using when you hit F5 and then edit the environment variables you can add the ASPNETCORE_URLS environment variable which will run the app using the port specified as shown here.
Rider Run configuration environment variables
Steps to edit the setting
- Open the edit screen for the run/build configuration
- Click the ellipsis on the environment variables edit box to edit
- Click the plus (+) symbol to add a new evironment variable
- Set the name to
ASPNETCORE_URLS
and the value tohttp://*:57243
- Save your changes and run
It turned out that the option in Visual Studio just changes the application.config in the .vs folder. A similar file in the .idea folder had the properties of the ports.
Changing it in that file fixed it.
@Sasquatch's answer works for ASP.NET Core only.
For plain old ASP.NET, with IIS Express, we can go the project properties, Web section, and then
- Make sure "Server type:" is "IIS Express".
- Check "Generate applicationhost.config". [*]
- Set "URL:" to "localhost".
- Set "Development port:" to whichever port you want ("1234" in this example).
- Click "OK" and restart the web application.
This will rewrite the generated applicationhost.config file (in .idea\config\ folder) with your selected configuration.
[*] If "Generate applicationhost.config" is unchecked, you should edit that file directly, like @WWietlol's answer suggests.