Can I setup multiple Development environments with different appsettings.xxx.json files and debug profiles?SQL Azure Federations - Development Environmentasp.net core development modelASP.NET Core deployment to IIS error: Development environment should not be enabled in deployed applicationsAzure SQL Database Error, but works in localhost debug modeHow does IHostingEnvironment.EnvironmentName work?Error after deploying asp.net core app to azureASPNETCORE_ENVIRONMENT environment variable to Development ErrorHow are configuration settings being loaded for ASP.NET Core on Azure?Asp.Net Core 2.1 Angular Template on Deployment machine detects environment as “Development”Azure Publish Error only in my controller but not in the homecontroller
How will losing mobility of one hand affect my career as a programmer?
When quoting, must I also copy hyphens used to divide words that continue on the next line?
A social experiment. What is the worst that can happen?
Can I use my Chinese passport to enter China after I acquired another citizenship?
Two-sided logarithm inequality
Diode in opposite direction?
Open a doc from terminal, but not by its name
anything or something to eat
Create all possible words using a set or letters
Does the Mind Blank spell prevent the target from being frightened?
Reply 'no position' while the job posting is still there
Did arcade monitors have same pixel aspect ratio as TV sets?
Is camera lens focus an exact point or a range?
THT: What is a squared annular “ring”?
Should I stop contributing to retirement accounts?
Did US corporations pay demonstrators in the German demonstrations against article 13?
What is the grammatical term for “‑ed” words like these?
Has Darkwing Duck ever met Scrooge McDuck?
What's the difference between 違法 and 不法?
How can Trident be so inexpensive? Will it orbit Triton or just do a (slow) flyby?
On a tidally locked planet, would time be quantized?
why `nmap 192.168.1.97` returns less services than `nmap 127.0.0.1`?
Can we have a perfect cadence in a minor key?
Greco-Roman egalitarianism
Can I setup multiple Development environments with different appsettings.xxx.json files and debug profiles?
SQL Azure Federations - Development Environmentasp.net core development modelASP.NET Core deployment to IIS error: Development environment should not be enabled in deployed applicationsAzure SQL Database Error, but works in localhost debug modeHow does IHostingEnvironment.EnvironmentName work?Error after deploying asp.net core app to azureASPNETCORE_ENVIRONMENT environment variable to Development ErrorHow are configuration settings being loaded for ASP.NET Core on Azure?Asp.Net Core 2.1 Angular Template on Deployment machine detects environment as “Development”Azure Publish Error only in my controller but not in the homecontroller
I've read a bit of documentation regarding setting up environments for deployment of ASP.Net Core applications. These articles usually reference Development. Staging and Production by name, but never deviate from these traditional environment names.
Usually, once you are out of "development", you want to turn off development/debugging settings so that sensitive information isn't leaked out onto the web in case your application crashes. This makes sense.
However, my application is in the early stages of development and I am in need of two development environment configurations that we can debug. Specifically, my team will largely want to develop locally, connecting to a local SQL Server database. However, we need to setup and test an Azure database and for preliminary setup, it would help if we could run the server development mode, locally, and be able to connect to our Azure databases from our dev boxes.
What I would like to do is create two config files named aspsettings.Development.json and aspsettings.LocalDevelopment.json, both of which are in my two ASP.Net core projects within my solution-- one for Web API and the other for the UI project.
Development will contain all values for connecting to the proper dev database servers (the Azure database used for development testing needing access to Azure) and the LocalDevelopment environment will be used for connecting to the local database.
I've added these files to my project, copied out the Development details to LocalDevelopment and changed just the connection strings for the API project config.
Next, I opened up my projects properties and added two profiles for debugging. As an attempt at figuring this out, I created these identical profiles for both the API project and the UI project. These profiles were named "IIS Local" and the other "IIS Dev Server". Finally, in each project page for each new profile, I entered their respective values for ASPNETCORE_ENVIRONMENT-- Development and LocalDevelopment.
When I debug the application as Development, it works fine. However, when I run the application using theLocalDevelopment` environment and profile, I'm getting the following error:
Error. An error occurred while processing your request. Request ID: 0HLLE04D5NFDU:00000001
Development Mode Swapping to Development environment will display more
detailed information about the error that occurred.
Development environment should not be enabled in deployed
applications, as it can result in sensitive information from
exceptions being displayed to end users. For local debugging,
development environment can be enabled by setting the
ASPNETCORE_ENVIRONMENT environment variable to Development, and
restarting the application.
This doesn't seem to make since because both configs are the same for their respective projects and the only differences are the connections strings in the API and, I did add an EnvironmentName property for identification.
What might I be doing wrong?
Here are the contents of the LocalDevelopment file. Just in case I'm missing something.
Settings in the API
"Logging":
"LogLevel":
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
,
"EnvironmentName": "LOCAL",
"ConnectionStrings":
"Database": "xxx"
Settings in the UI
"Logging":
"LogLevel":
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
add a comment |
I've read a bit of documentation regarding setting up environments for deployment of ASP.Net Core applications. These articles usually reference Development. Staging and Production by name, but never deviate from these traditional environment names.
Usually, once you are out of "development", you want to turn off development/debugging settings so that sensitive information isn't leaked out onto the web in case your application crashes. This makes sense.
However, my application is in the early stages of development and I am in need of two development environment configurations that we can debug. Specifically, my team will largely want to develop locally, connecting to a local SQL Server database. However, we need to setup and test an Azure database and for preliminary setup, it would help if we could run the server development mode, locally, and be able to connect to our Azure databases from our dev boxes.
What I would like to do is create two config files named aspsettings.Development.json and aspsettings.LocalDevelopment.json, both of which are in my two ASP.Net core projects within my solution-- one for Web API and the other for the UI project.
Development will contain all values for connecting to the proper dev database servers (the Azure database used for development testing needing access to Azure) and the LocalDevelopment environment will be used for connecting to the local database.
I've added these files to my project, copied out the Development details to LocalDevelopment and changed just the connection strings for the API project config.
Next, I opened up my projects properties and added two profiles for debugging. As an attempt at figuring this out, I created these identical profiles for both the API project and the UI project. These profiles were named "IIS Local" and the other "IIS Dev Server". Finally, in each project page for each new profile, I entered their respective values for ASPNETCORE_ENVIRONMENT-- Development and LocalDevelopment.
When I debug the application as Development, it works fine. However, when I run the application using theLocalDevelopment` environment and profile, I'm getting the following error:
Error. An error occurred while processing your request. Request ID: 0HLLE04D5NFDU:00000001
Development Mode Swapping to Development environment will display more
detailed information about the error that occurred.
Development environment should not be enabled in deployed
applications, as it can result in sensitive information from
exceptions being displayed to end users. For local debugging,
development environment can be enabled by setting the
ASPNETCORE_ENVIRONMENT environment variable to Development, and
restarting the application.
This doesn't seem to make since because both configs are the same for their respective projects and the only differences are the connections strings in the API and, I did add an EnvironmentName property for identification.
What might I be doing wrong?
Here are the contents of the LocalDevelopment file. Just in case I'm missing something.
Settings in the API
"Logging":
"LogLevel":
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
,
"EnvironmentName": "LOCAL",
"ConnectionStrings":
"Database": "xxx"
Settings in the UI
"Logging":
"LogLevel":
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
add a comment |
I've read a bit of documentation regarding setting up environments for deployment of ASP.Net Core applications. These articles usually reference Development. Staging and Production by name, but never deviate from these traditional environment names.
Usually, once you are out of "development", you want to turn off development/debugging settings so that sensitive information isn't leaked out onto the web in case your application crashes. This makes sense.
However, my application is in the early stages of development and I am in need of two development environment configurations that we can debug. Specifically, my team will largely want to develop locally, connecting to a local SQL Server database. However, we need to setup and test an Azure database and for preliminary setup, it would help if we could run the server development mode, locally, and be able to connect to our Azure databases from our dev boxes.
What I would like to do is create two config files named aspsettings.Development.json and aspsettings.LocalDevelopment.json, both of which are in my two ASP.Net core projects within my solution-- one for Web API and the other for the UI project.
Development will contain all values for connecting to the proper dev database servers (the Azure database used for development testing needing access to Azure) and the LocalDevelopment environment will be used for connecting to the local database.
I've added these files to my project, copied out the Development details to LocalDevelopment and changed just the connection strings for the API project config.
Next, I opened up my projects properties and added two profiles for debugging. As an attempt at figuring this out, I created these identical profiles for both the API project and the UI project. These profiles were named "IIS Local" and the other "IIS Dev Server". Finally, in each project page for each new profile, I entered their respective values for ASPNETCORE_ENVIRONMENT-- Development and LocalDevelopment.
When I debug the application as Development, it works fine. However, when I run the application using theLocalDevelopment` environment and profile, I'm getting the following error:
Error. An error occurred while processing your request. Request ID: 0HLLE04D5NFDU:00000001
Development Mode Swapping to Development environment will display more
detailed information about the error that occurred.
Development environment should not be enabled in deployed
applications, as it can result in sensitive information from
exceptions being displayed to end users. For local debugging,
development environment can be enabled by setting the
ASPNETCORE_ENVIRONMENT environment variable to Development, and
restarting the application.
This doesn't seem to make since because both configs are the same for their respective projects and the only differences are the connections strings in the API and, I did add an EnvironmentName property for identification.
What might I be doing wrong?
Here are the contents of the LocalDevelopment file. Just in case I'm missing something.
Settings in the API
"Logging":
"LogLevel":
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
,
"EnvironmentName": "LOCAL",
"ConnectionStrings":
"Database": "xxx"
Settings in the UI
"Logging":
"LogLevel":
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
I've read a bit of documentation regarding setting up environments for deployment of ASP.Net Core applications. These articles usually reference Development. Staging and Production by name, but never deviate from these traditional environment names.
Usually, once you are out of "development", you want to turn off development/debugging settings so that sensitive information isn't leaked out onto the web in case your application crashes. This makes sense.
However, my application is in the early stages of development and I am in need of two development environment configurations that we can debug. Specifically, my team will largely want to develop locally, connecting to a local SQL Server database. However, we need to setup and test an Azure database and for preliminary setup, it would help if we could run the server development mode, locally, and be able to connect to our Azure databases from our dev boxes.
What I would like to do is create two config files named aspsettings.Development.json and aspsettings.LocalDevelopment.json, both of which are in my two ASP.Net core projects within my solution-- one for Web API and the other for the UI project.
Development will contain all values for connecting to the proper dev database servers (the Azure database used for development testing needing access to Azure) and the LocalDevelopment environment will be used for connecting to the local database.
I've added these files to my project, copied out the Development details to LocalDevelopment and changed just the connection strings for the API project config.
Next, I opened up my projects properties and added two profiles for debugging. As an attempt at figuring this out, I created these identical profiles for both the API project and the UI project. These profiles were named "IIS Local" and the other "IIS Dev Server". Finally, in each project page for each new profile, I entered their respective values for ASPNETCORE_ENVIRONMENT-- Development and LocalDevelopment.
When I debug the application as Development, it works fine. However, when I run the application using theLocalDevelopment` environment and profile, I'm getting the following error:
Error. An error occurred while processing your request. Request ID: 0HLLE04D5NFDU:00000001
Development Mode Swapping to Development environment will display more
detailed information about the error that occurred.
Development environment should not be enabled in deployed
applications, as it can result in sensitive information from
exceptions being displayed to end users. For local debugging,
development environment can be enabled by setting the
ASPNETCORE_ENVIRONMENT environment variable to Development, and
restarting the application.
This doesn't seem to make since because both configs are the same for their respective projects and the only differences are the connections strings in the API and, I did add an EnvironmentName property for identification.
What might I be doing wrong?
Here are the contents of the LocalDevelopment file. Just in case I'm missing something.
Settings in the API
"Logging":
"LogLevel":
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
,
"EnvironmentName": "LOCAL",
"ConnectionStrings":
"Database": "xxx"
Settings in the UI
"Logging":
"LogLevel":
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
asked Mar 21 at 13:51
RLHRLH
7,9121972152
7,9121972152
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
In your Startup.cs, you likely have something like the following in your Configure method:
if (env.IsDevelopment())
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
else
app.UseExceptionHandler("/error/500");
You need to change the conditional to be something like:
if (env.IsDevelopment() || env.IsEnvironment("LocalDevelopment"))
Or you can simply make any environment that's not production using the development error pages:
if (!env.IsProduction())
The methods like IsDevelopment, IsProduction, etc. are just syntactic sugar so you don't have to do IsEnvironment("Development"). However, since LocalDevelopment is of your own creation, there's obviously not a method built-in for that.
Ah, that's it. This is the first ASP.Net Core project I've had to work with, and my first "brand new" project I've probably worked on in nearly 10 years. (There's so much maintenance and upgrades to be made out there!) These types of configs/environments are new territory for me. Thanks for the help.
– RLH
Mar 21 at 14:34
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55281975%2fcan-i-setup-multiple-development-environments-with-different-appsettings-xxx-jso%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In your Startup.cs, you likely have something like the following in your Configure method:
if (env.IsDevelopment())
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
else
app.UseExceptionHandler("/error/500");
You need to change the conditional to be something like:
if (env.IsDevelopment() || env.IsEnvironment("LocalDevelopment"))
Or you can simply make any environment that's not production using the development error pages:
if (!env.IsProduction())
The methods like IsDevelopment, IsProduction, etc. are just syntactic sugar so you don't have to do IsEnvironment("Development"). However, since LocalDevelopment is of your own creation, there's obviously not a method built-in for that.
Ah, that's it. This is the first ASP.Net Core project I've had to work with, and my first "brand new" project I've probably worked on in nearly 10 years. (There's so much maintenance and upgrades to be made out there!) These types of configs/environments are new territory for me. Thanks for the help.
– RLH
Mar 21 at 14:34
add a comment |
In your Startup.cs, you likely have something like the following in your Configure method:
if (env.IsDevelopment())
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
else
app.UseExceptionHandler("/error/500");
You need to change the conditional to be something like:
if (env.IsDevelopment() || env.IsEnvironment("LocalDevelopment"))
Or you can simply make any environment that's not production using the development error pages:
if (!env.IsProduction())
The methods like IsDevelopment, IsProduction, etc. are just syntactic sugar so you don't have to do IsEnvironment("Development"). However, since LocalDevelopment is of your own creation, there's obviously not a method built-in for that.
Ah, that's it. This is the first ASP.Net Core project I've had to work with, and my first "brand new" project I've probably worked on in nearly 10 years. (There's so much maintenance and upgrades to be made out there!) These types of configs/environments are new territory for me. Thanks for the help.
– RLH
Mar 21 at 14:34
add a comment |
In your Startup.cs, you likely have something like the following in your Configure method:
if (env.IsDevelopment())
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
else
app.UseExceptionHandler("/error/500");
You need to change the conditional to be something like:
if (env.IsDevelopment() || env.IsEnvironment("LocalDevelopment"))
Or you can simply make any environment that's not production using the development error pages:
if (!env.IsProduction())
The methods like IsDevelopment, IsProduction, etc. are just syntactic sugar so you don't have to do IsEnvironment("Development"). However, since LocalDevelopment is of your own creation, there's obviously not a method built-in for that.
In your Startup.cs, you likely have something like the following in your Configure method:
if (env.IsDevelopment())
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
else
app.UseExceptionHandler("/error/500");
You need to change the conditional to be something like:
if (env.IsDevelopment() || env.IsEnvironment("LocalDevelopment"))
Or you can simply make any environment that's not production using the development error pages:
if (!env.IsProduction())
The methods like IsDevelopment, IsProduction, etc. are just syntactic sugar so you don't have to do IsEnvironment("Development"). However, since LocalDevelopment is of your own creation, there's obviously not a method built-in for that.
answered Mar 21 at 14:21
Chris PrattChris Pratt
159k21241309
159k21241309
Ah, that's it. This is the first ASP.Net Core project I've had to work with, and my first "brand new" project I've probably worked on in nearly 10 years. (There's so much maintenance and upgrades to be made out there!) These types of configs/environments are new territory for me. Thanks for the help.
– RLH
Mar 21 at 14:34
add a comment |
Ah, that's it. This is the first ASP.Net Core project I've had to work with, and my first "brand new" project I've probably worked on in nearly 10 years. (There's so much maintenance and upgrades to be made out there!) These types of configs/environments are new territory for me. Thanks for the help.
– RLH
Mar 21 at 14:34
Ah, that's it. This is the first ASP.Net Core project I've had to work with, and my first "brand new" project I've probably worked on in nearly 10 years. (There's so much maintenance and upgrades to be made out there!) These types of configs/environments are new territory for me. Thanks for the help.
– RLH
Mar 21 at 14:34
Ah, that's it. This is the first ASP.Net Core project I've had to work with, and my first "brand new" project I've probably worked on in nearly 10 years. (There's so much maintenance and upgrades to be made out there!) These types of configs/environments are new territory for me. Thanks for the help.
– RLH
Mar 21 at 14:34
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55281975%2fcan-i-setup-multiple-development-environments-with-different-appsettings-xxx-jso%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown