SAFE-template icon indicating copy to clipboard operation
SAFE-template copied to clipboard

Dotnet run opens the wrong URL

Open inputusernamehere opened this issue 4 years ago • 3 comments

After creating a new project with the template, running the command dotnet run results in my browser opening a tab with the url http://0.0.0.0:8085/. However this is the backend's URL. Shouldn't it open the client instead, at :8080?

inputusernamehere avatar Aug 04 '21 12:08 inputusernamehere

The template stopped automatically opening a browser tab a while back because it's annoying while working on a project when you already have the browser tab ready to go.

Do you use Visual Studio? It creates launchSettings.json with "launchBrowser": true. This then causes dotnet to launch the browser on run. I'm not sure how to correct the port here but you can at least change launchBrowser to false.

theprash avatar Aug 04 '21 14:08 theprash

Ahh must be the case yeah, I do indeed have a launchSettings.json file with "launchBrowser": true. Case solved. Maybe it would be better for the template to include a launcSettings.json where that setting is set to false?

inputusernamehere avatar Aug 04 '21 19:08 inputusernamehere

@theprash I've seen this too. Either including a file that stops this happening, or including documentation to explain this, would be my suggestion.

isaacabraham avatar Aug 04 '21 19:08 isaacabraham

I found a better fix for this issue than including a default file. You can add <NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile to Server.fsproj. I opened PR #523 to make this change to both default and minimal templates.

theprash avatar Sep 05 '22 12:09 theprash

Actually cancel that (my last comment). If we remove the file then the environment is defaulted to Production while running in dev. So I've opened PR #524 to add launchSettings.json to the minimal template as well.

theprash avatar Sep 05 '22 13:09 theprash