'Environment Variable for debugging in Visual Studio 2022
I have a problem in Environment Variable in Visual studio 2022. When I use Development there is no problem and it takes development AppSettings,
But when I remove Environment variable to use production (Default AppSettings) it brings me Error and It doesn't run.
What should I do to use default AppSetting in debug mode?
the error is 404 not found :
Solution 1:[1]
if you are using swagger check the swagger middlware. it should be out of development environment, just modify this line of code in program.cs:
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
to this:
if (app.Environment.IsDevelopment())
{
}
app.UseSwagger();
app.UseSwaggerUI();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jafar ashrafi |