✅ launchSettings.json being ignored completely
All of a sudden, my .NET Visual Studio project has stopped respecting my
launchSettings.json
file. No matter what profile I run the app with, it uses the ports 5000
and 5001
. I have no idea how this happened or why.
launchSettings.json
9 Replies
I cant recall exactly, but the behaviour changes a bit depending upon whether your debug target launches 'the project' or iis express. Check the debug drop-down next to the build config option
My debug target is WSL, I'm not sure which dropdown you want me to check. This is all I see in the "Debug" dropdown you described
this thing
Make sure you have set your launch profile as the 'Active profile' in Visual Studio by right-clicking on the project in the Solution Explorer and selecting 'Set as StartUp Project'. Then, right-click on the project and select 'Properties', go to 'Debug', and ensure that you have selected the correct launch profile as the 'Launch profile'.
Check that the path to 'launchsettings.json' in your project is correct. 'launchsettings.json' is typically located in the root folder of your project, under a folder called 'Properties'.
Make sure that you have not overwritten the settings in 'launchsettings.json' in your code or elsewhere. It may be that you have hard-coded a different path for your application to start on, and therefore 'launchsettings.json' is being ignored.
I tried setting the project as startup project, did not change anything. I also checked the properties, but all is shows me is this, and that just brings me to a UI where I can see all profiles defined in launchsettings.
The launchsettings is in the same directory it has always been in, the 'Properties' one.
And I can not imagine that I would've overriden anything in my code.
Do you have a master global json with any ports configurations?
Ensure there’s no stray ASPNETCORE_URLS variable set at the system or user level that could be overriding your configuration.
Also try cleaning and building again
Apparently I was adding
IConfiguration
as a singleton in my Program.cs
. Commenting that line out solved it. No idea why but I guess it fixed my issue