ASPNETCORE_ENVIRONMENT set to “Development” somehow limits API calls2019 Community Moderator ElectionUnable to find Use.RunTimePageInfo() method in startup.cs file in aspnet coreHow do I dynamically choose a connection string based on Environment in .Net Core startup?502 Error, IIS8 ASP .NET CORE AspNetCore.AntiforgeryIdentityServer 4. Invalid operation Exception in MVC Client of IClientStoreHow to debug startup in Web Core API?Swashbuckle root error when i deploy on subfolderHow to get client ip address and domain url in configure_services method -core 2.0SignalR / Chat Sample .Net Core WebSocket is not in the OPEN stateProblem with asp core 2.1 and AWS cognito OIDC connectionforce innodb engine with Pomelo.EntityFrameworkCore.MySql 2.1.4

What is better: yes / no radio, or simple checkbox?

Is divide-by-zero a security vulnerability?

Strange opamp's output impedance in spice

Why do we say 'Pairwise Disjoint', rather than 'Disjoint'?

Does an unused member variable take up memory?

Short scifi story where reproductive organs are converted to produce "materials", pregnant protagonist is "found fit" to be a mother

What is the purpose of a disclaimer like "this is not legal advice"?

Which country has more?

Can one live in the U.S. and not use a credit card?

Is this Paypal Github SDK reference really a dangerous site?

Smooth vector fields on a surface modulo diffeomorphisms

Trocar background-image com delay via jQuery

I can't die. Who am I?

What can I do if someone tampers with my SSH public key?

Use Mercury as quenching liquid for swords?

Is there stress on two letters on the word стоят

Was it really inappropriate to write a pull request for the company I interviewed with?

Are small insurances worth it?

Do black holes violate the conservation of mass?

The (Easy) Road to Code

I am the person who abides by rules, but breaks the rules. Who am I?

How do you make a gun that shoots melee weapons and/or swords?

Giving a career talk in my old university, how prominently should I tell students my salary?

Either of .... (Plural/Singular)



ASPNETCORE_ENVIRONMENT set to “Development” somehow limits API calls



2019 Community Moderator ElectionUnable to find Use.RunTimePageInfo() method in startup.cs file in aspnet coreHow do I dynamically choose a connection string based on Environment in .Net Core startup?502 Error, IIS8 ASP .NET CORE AspNetCore.AntiforgeryIdentityServer 4. Invalid operation Exception in MVC Client of IClientStoreHow to debug startup in Web Core API?Swashbuckle root error when i deploy on subfolderHow to get client ip address and domain url in configure_services method -core 2.0SignalR / Chat Sample .Net Core WebSocket is not in the OPEN stateProblem with asp core 2.1 and AWS cognito OIDC connectionforce innodb engine with Pomelo.EntityFrameworkCore.MySql 2.1.4










0















I'm working on a simple .net core API and noticed a strange behavior I can't explain:



API works fine until a point (40-50 calls) where every calls fail and return a HTTP Error 502.3 - Bad Gateway after timeout.



After some investigations I figured out this behavior not appearing when I remove the ASPNETCORE_ENVIRONMENT (set to development) in config files.



So, concretely, which differences implies my ASPNETCORE_ENVIRONMENT setted to Development? How can I manage to get it work with this setting?



public class Startup

public Startup(IConfiguration configuration)

Configuration = configuration;


public IConfiguration Configuration get;

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)

var dbString = Configuration["Database:ConnectionString"];

services.AddScoped<ISearchEngineRepository, SearchEngineRepository>();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddDbContext<VvpDbContext>(options => options.UseSqlServer(dbString), ServiceLifetime.Transient);
services.AddSingleton(Configuration);
services.AddCors();


// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)

if (env.IsDevelopment())

app.UseDeveloperExceptionPage();
app.UseCors(options => options.WithOrigins("http://localhost:4200").AllowAnyMethod());

else

app.UseHsts();


app.UseMvc();











share|improve this question









New contributor




klem76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • It's just an environment variable. The value alone doesn't do anything. As to what effect a different value might have on your application, that is impossible to say without seeing you app code, specifically your Startup.cs, though even that may not be enough. All kinds of things can be made to be dependent on a particular environment value, but nothing necessarily by default.

    – Chris Pratt
    Mar 6 at 15:44











  • I see. As far as I remember I don't specify any settings based on this variable (except the env.IsDevelopment() condition in startup.cs I edited on my post above, still same if I remove it tho...). I think that's maybe due to IIS but I have no idea if and how this variable is used there...

    – klem76
    Mar 6 at 16:12











  • It's not. The ASPNETCORE_ENVIRONMENT environment variable is specifically used by the IHostingEnvironment abstraction and as such is always utilized at a programmatic level, i.e. some sort of conditional in your actual code. IIS doesn't know or care about any of this.

    – Chris Pratt
    Mar 6 at 17:54











  • My attention is now focused on the IISSupport folder in the bin folder of the API. There's a file IISExeLauncherArgs.txt in it in which ASPNETCORE_ENVIRONMENT is mentioned. After deleting bin and obj folder and regenerating the solution, it seems to work fine... But still can't explain why.

    – klem76
    2 days ago
















0















I'm working on a simple .net core API and noticed a strange behavior I can't explain:



API works fine until a point (40-50 calls) where every calls fail and return a HTTP Error 502.3 - Bad Gateway after timeout.



After some investigations I figured out this behavior not appearing when I remove the ASPNETCORE_ENVIRONMENT (set to development) in config files.



So, concretely, which differences implies my ASPNETCORE_ENVIRONMENT setted to Development? How can I manage to get it work with this setting?



public class Startup

public Startup(IConfiguration configuration)

Configuration = configuration;


public IConfiguration Configuration get;

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)

var dbString = Configuration["Database:ConnectionString"];

services.AddScoped<ISearchEngineRepository, SearchEngineRepository>();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddDbContext<VvpDbContext>(options => options.UseSqlServer(dbString), ServiceLifetime.Transient);
services.AddSingleton(Configuration);
services.AddCors();


// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)

if (env.IsDevelopment())

app.UseDeveloperExceptionPage();
app.UseCors(options => options.WithOrigins("http://localhost:4200").AllowAnyMethod());

else

app.UseHsts();


app.UseMvc();











share|improve this question









New contributor




klem76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • It's just an environment variable. The value alone doesn't do anything. As to what effect a different value might have on your application, that is impossible to say without seeing you app code, specifically your Startup.cs, though even that may not be enough. All kinds of things can be made to be dependent on a particular environment value, but nothing necessarily by default.

    – Chris Pratt
    Mar 6 at 15:44











  • I see. As far as I remember I don't specify any settings based on this variable (except the env.IsDevelopment() condition in startup.cs I edited on my post above, still same if I remove it tho...). I think that's maybe due to IIS but I have no idea if and how this variable is used there...

    – klem76
    Mar 6 at 16:12











  • It's not. The ASPNETCORE_ENVIRONMENT environment variable is specifically used by the IHostingEnvironment abstraction and as such is always utilized at a programmatic level, i.e. some sort of conditional in your actual code. IIS doesn't know or care about any of this.

    – Chris Pratt
    Mar 6 at 17:54











  • My attention is now focused on the IISSupport folder in the bin folder of the API. There's a file IISExeLauncherArgs.txt in it in which ASPNETCORE_ENVIRONMENT is mentioned. After deleting bin and obj folder and regenerating the solution, it seems to work fine... But still can't explain why.

    – klem76
    2 days ago














0












0








0








I'm working on a simple .net core API and noticed a strange behavior I can't explain:



API works fine until a point (40-50 calls) where every calls fail and return a HTTP Error 502.3 - Bad Gateway after timeout.



After some investigations I figured out this behavior not appearing when I remove the ASPNETCORE_ENVIRONMENT (set to development) in config files.



So, concretely, which differences implies my ASPNETCORE_ENVIRONMENT setted to Development? How can I manage to get it work with this setting?



public class Startup

public Startup(IConfiguration configuration)

Configuration = configuration;


public IConfiguration Configuration get;

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)

var dbString = Configuration["Database:ConnectionString"];

services.AddScoped<ISearchEngineRepository, SearchEngineRepository>();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddDbContext<VvpDbContext>(options => options.UseSqlServer(dbString), ServiceLifetime.Transient);
services.AddSingleton(Configuration);
services.AddCors();


// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)

if (env.IsDevelopment())

app.UseDeveloperExceptionPage();
app.UseCors(options => options.WithOrigins("http://localhost:4200").AllowAnyMethod());

else

app.UseHsts();


app.UseMvc();











share|improve this question









New contributor




klem76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I'm working on a simple .net core API and noticed a strange behavior I can't explain:



API works fine until a point (40-50 calls) where every calls fail and return a HTTP Error 502.3 - Bad Gateway after timeout.



After some investigations I figured out this behavior not appearing when I remove the ASPNETCORE_ENVIRONMENT (set to development) in config files.



So, concretely, which differences implies my ASPNETCORE_ENVIRONMENT setted to Development? How can I manage to get it work with this setting?



public class Startup

public Startup(IConfiguration configuration)

Configuration = configuration;


public IConfiguration Configuration get;

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)

var dbString = Configuration["Database:ConnectionString"];

services.AddScoped<ISearchEngineRepository, SearchEngineRepository>();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddDbContext<VvpDbContext>(options => options.UseSqlServer(dbString), ServiceLifetime.Transient);
services.AddSingleton(Configuration);
services.AddCors();


// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)

if (env.IsDevelopment())

app.UseDeveloperExceptionPage();
app.UseCors(options => options.WithOrigins("http://localhost:4200").AllowAnyMethod());

else

app.UseHsts();


app.UseMvc();








.net iis asp.net-core asp.net-core-webapi






share|improve this question









New contributor




klem76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




klem76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Mar 6 at 15:58







klem76













New contributor




klem76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Mar 6 at 13:25









klem76klem76

11




11




New contributor




klem76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





klem76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






klem76 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • It's just an environment variable. The value alone doesn't do anything. As to what effect a different value might have on your application, that is impossible to say without seeing you app code, specifically your Startup.cs, though even that may not be enough. All kinds of things can be made to be dependent on a particular environment value, but nothing necessarily by default.

    – Chris Pratt
    Mar 6 at 15:44











  • I see. As far as I remember I don't specify any settings based on this variable (except the env.IsDevelopment() condition in startup.cs I edited on my post above, still same if I remove it tho...). I think that's maybe due to IIS but I have no idea if and how this variable is used there...

    – klem76
    Mar 6 at 16:12











  • It's not. The ASPNETCORE_ENVIRONMENT environment variable is specifically used by the IHostingEnvironment abstraction and as such is always utilized at a programmatic level, i.e. some sort of conditional in your actual code. IIS doesn't know or care about any of this.

    – Chris Pratt
    Mar 6 at 17:54











  • My attention is now focused on the IISSupport folder in the bin folder of the API. There's a file IISExeLauncherArgs.txt in it in which ASPNETCORE_ENVIRONMENT is mentioned. After deleting bin and obj folder and regenerating the solution, it seems to work fine... But still can't explain why.

    – klem76
    2 days ago


















  • It's just an environment variable. The value alone doesn't do anything. As to what effect a different value might have on your application, that is impossible to say without seeing you app code, specifically your Startup.cs, though even that may not be enough. All kinds of things can be made to be dependent on a particular environment value, but nothing necessarily by default.

    – Chris Pratt
    Mar 6 at 15:44











  • I see. As far as I remember I don't specify any settings based on this variable (except the env.IsDevelopment() condition in startup.cs I edited on my post above, still same if I remove it tho...). I think that's maybe due to IIS but I have no idea if and how this variable is used there...

    – klem76
    Mar 6 at 16:12











  • It's not. The ASPNETCORE_ENVIRONMENT environment variable is specifically used by the IHostingEnvironment abstraction and as such is always utilized at a programmatic level, i.e. some sort of conditional in your actual code. IIS doesn't know or care about any of this.

    – Chris Pratt
    Mar 6 at 17:54











  • My attention is now focused on the IISSupport folder in the bin folder of the API. There's a file IISExeLauncherArgs.txt in it in which ASPNETCORE_ENVIRONMENT is mentioned. After deleting bin and obj folder and regenerating the solution, it seems to work fine... But still can't explain why.

    – klem76
    2 days ago

















It's just an environment variable. The value alone doesn't do anything. As to what effect a different value might have on your application, that is impossible to say without seeing you app code, specifically your Startup.cs, though even that may not be enough. All kinds of things can be made to be dependent on a particular environment value, but nothing necessarily by default.

– Chris Pratt
Mar 6 at 15:44





It's just an environment variable. The value alone doesn't do anything. As to what effect a different value might have on your application, that is impossible to say without seeing you app code, specifically your Startup.cs, though even that may not be enough. All kinds of things can be made to be dependent on a particular environment value, but nothing necessarily by default.

– Chris Pratt
Mar 6 at 15:44













I see. As far as I remember I don't specify any settings based on this variable (except the env.IsDevelopment() condition in startup.cs I edited on my post above, still same if I remove it tho...). I think that's maybe due to IIS but I have no idea if and how this variable is used there...

– klem76
Mar 6 at 16:12





I see. As far as I remember I don't specify any settings based on this variable (except the env.IsDevelopment() condition in startup.cs I edited on my post above, still same if I remove it tho...). I think that's maybe due to IIS but I have no idea if and how this variable is used there...

– klem76
Mar 6 at 16:12













It's not. The ASPNETCORE_ENVIRONMENT environment variable is specifically used by the IHostingEnvironment abstraction and as such is always utilized at a programmatic level, i.e. some sort of conditional in your actual code. IIS doesn't know or care about any of this.

– Chris Pratt
Mar 6 at 17:54





It's not. The ASPNETCORE_ENVIRONMENT environment variable is specifically used by the IHostingEnvironment abstraction and as such is always utilized at a programmatic level, i.e. some sort of conditional in your actual code. IIS doesn't know or care about any of this.

– Chris Pratt
Mar 6 at 17:54













My attention is now focused on the IISSupport folder in the bin folder of the API. There's a file IISExeLauncherArgs.txt in it in which ASPNETCORE_ENVIRONMENT is mentioned. After deleting bin and obj folder and regenerating the solution, it seems to work fine... But still can't explain why.

– klem76
2 days ago






My attention is now focused on the IISSupport folder in the bin folder of the API. There's a file IISExeLauncherArgs.txt in it in which ASPNETCORE_ENVIRONMENT is mentioned. After deleting bin and obj folder and regenerating the solution, it seems to work fine... But still can't explain why.

– klem76
2 days ago













0






active

oldest

votes











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
);



);






klem76 is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55024221%2faspnetcore-environment-set-to-development-somehow-limits-api-calls%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








klem76 is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















klem76 is a new contributor. Be nice, and check out our Code of Conduct.












klem76 is a new contributor. Be nice, and check out our Code of Conduct.











klem76 is a new contributor. Be nice, and check out our Code of Conduct.














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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55024221%2faspnetcore-environment-set-to-development-somehow-limits-api-calls%23new-answer', 'question_page');

);

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







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко