Timeouts in .net core service
I have a .NET Core service, which I host in Azure as an app service.
By default it was timing out after 2 minutes, but then I added requestTimeout="00:30:00" into aspNetCore element of the web.config.
This, however, extends the timeout period only to approximately 4 minutes.
I'm looking to find where that value is coming from and how to increase it.
Below is the BuildWebHost method and Startup methods: Configure and ConfigureServices that I use.
public static IWebHost BuildWebHost(string args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((context, config) =>
{
IHostingEnvironment env = context.HostingEnvironment;
config.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables();
config.AddAzureKeyVault(
Environment.GetEnvironmentVariable("Vault"),
Environment.GetEnvironmentVariable("VaultClientId"),
Environment.GetEnvironmentVariable("VaultClientSecret")
);
var builtConfig = config.Build();
})
.ConfigureServices(services =>
{
// my services here
})
.UseStartup<Startup>()
.Build();
}
public void ConfigureServices(IServiceCollection services)
{
services.AddCors();
// my interfaces here
services.AddAuthentication(sharedOptions =>
{
sharedOptions.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer("Jwt", options =>
{
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
ValidateIssuerSigningKey = true,
ValidIssuer = Configuration["Jwt:Issuer"],
ValidAudience = Configuration["Jwt:Issuer"],
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Environment.GetEnvironmentVariable("JWT_KEY")))
};
})
.AddScheme<AuthenticationSchemeOptions, ApiKeyHandler>("ApiKey", null);
services.AddLogging(builder =>
{
builder.AddConfiguration(Configuration.GetSection("Logging"))
.AddConsole()
.AddDebug();
});
services.AddResponseCaching();
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Title = "MyApp", Version = "v1" });
});
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseCors(builder =>
{
builder.WithOrigins("*")
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.RoutePrefix = string.Empty;
c.SwaggerEndpoint("/swagger/v1/swagger.json", "MyApp");
});
app.UseResponseCaching();
app.UseAuthentication();
app.UseMvc();
}
And here's my web.config also for reference:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore requestTimeout="00:30:00" processPath="dotnet" arguments=".MyApp.dll" stdoutLogEnabled="false" stdoutLogFile=".logsstdout" />
</system.webServer>
</location>
</configuration>
Any help would be appreciated.
.net-core timeout asp.net-core-mvc asp.net-core-webapi
add a comment |
I have a .NET Core service, which I host in Azure as an app service.
By default it was timing out after 2 minutes, but then I added requestTimeout="00:30:00" into aspNetCore element of the web.config.
This, however, extends the timeout period only to approximately 4 minutes.
I'm looking to find where that value is coming from and how to increase it.
Below is the BuildWebHost method and Startup methods: Configure and ConfigureServices that I use.
public static IWebHost BuildWebHost(string args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((context, config) =>
{
IHostingEnvironment env = context.HostingEnvironment;
config.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables();
config.AddAzureKeyVault(
Environment.GetEnvironmentVariable("Vault"),
Environment.GetEnvironmentVariable("VaultClientId"),
Environment.GetEnvironmentVariable("VaultClientSecret")
);
var builtConfig = config.Build();
})
.ConfigureServices(services =>
{
// my services here
})
.UseStartup<Startup>()
.Build();
}
public void ConfigureServices(IServiceCollection services)
{
services.AddCors();
// my interfaces here
services.AddAuthentication(sharedOptions =>
{
sharedOptions.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer("Jwt", options =>
{
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
ValidateIssuerSigningKey = true,
ValidIssuer = Configuration["Jwt:Issuer"],
ValidAudience = Configuration["Jwt:Issuer"],
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Environment.GetEnvironmentVariable("JWT_KEY")))
};
})
.AddScheme<AuthenticationSchemeOptions, ApiKeyHandler>("ApiKey", null);
services.AddLogging(builder =>
{
builder.AddConfiguration(Configuration.GetSection("Logging"))
.AddConsole()
.AddDebug();
});
services.AddResponseCaching();
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Title = "MyApp", Version = "v1" });
});
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseCors(builder =>
{
builder.WithOrigins("*")
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.RoutePrefix = string.Empty;
c.SwaggerEndpoint("/swagger/v1/swagger.json", "MyApp");
});
app.UseResponseCaching();
app.UseAuthentication();
app.UseMvc();
}
And here's my web.config also for reference:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore requestTimeout="00:30:00" processPath="dotnet" arguments=".MyApp.dll" stdoutLogEnabled="false" stdoutLogFile=".logsstdout" />
</system.webServer>
</location>
</configuration>
Any help would be appreciated.
.net-core timeout asp.net-core-mvc asp.net-core-webapi
add a comment |
I have a .NET Core service, which I host in Azure as an app service.
By default it was timing out after 2 minutes, but then I added requestTimeout="00:30:00" into aspNetCore element of the web.config.
This, however, extends the timeout period only to approximately 4 minutes.
I'm looking to find where that value is coming from and how to increase it.
Below is the BuildWebHost method and Startup methods: Configure and ConfigureServices that I use.
public static IWebHost BuildWebHost(string args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((context, config) =>
{
IHostingEnvironment env = context.HostingEnvironment;
config.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables();
config.AddAzureKeyVault(
Environment.GetEnvironmentVariable("Vault"),
Environment.GetEnvironmentVariable("VaultClientId"),
Environment.GetEnvironmentVariable("VaultClientSecret")
);
var builtConfig = config.Build();
})
.ConfigureServices(services =>
{
// my services here
})
.UseStartup<Startup>()
.Build();
}
public void ConfigureServices(IServiceCollection services)
{
services.AddCors();
// my interfaces here
services.AddAuthentication(sharedOptions =>
{
sharedOptions.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer("Jwt", options =>
{
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
ValidateIssuerSigningKey = true,
ValidIssuer = Configuration["Jwt:Issuer"],
ValidAudience = Configuration["Jwt:Issuer"],
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Environment.GetEnvironmentVariable("JWT_KEY")))
};
})
.AddScheme<AuthenticationSchemeOptions, ApiKeyHandler>("ApiKey", null);
services.AddLogging(builder =>
{
builder.AddConfiguration(Configuration.GetSection("Logging"))
.AddConsole()
.AddDebug();
});
services.AddResponseCaching();
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Title = "MyApp", Version = "v1" });
});
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseCors(builder =>
{
builder.WithOrigins("*")
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.RoutePrefix = string.Empty;
c.SwaggerEndpoint("/swagger/v1/swagger.json", "MyApp");
});
app.UseResponseCaching();
app.UseAuthentication();
app.UseMvc();
}
And here's my web.config also for reference:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore requestTimeout="00:30:00" processPath="dotnet" arguments=".MyApp.dll" stdoutLogEnabled="false" stdoutLogFile=".logsstdout" />
</system.webServer>
</location>
</configuration>
Any help would be appreciated.
.net-core timeout asp.net-core-mvc asp.net-core-webapi
I have a .NET Core service, which I host in Azure as an app service.
By default it was timing out after 2 minutes, but then I added requestTimeout="00:30:00" into aspNetCore element of the web.config.
This, however, extends the timeout period only to approximately 4 minutes.
I'm looking to find where that value is coming from and how to increase it.
Below is the BuildWebHost method and Startup methods: Configure and ConfigureServices that I use.
public static IWebHost BuildWebHost(string args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((context, config) =>
{
IHostingEnvironment env = context.HostingEnvironment;
config.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables();
config.AddAzureKeyVault(
Environment.GetEnvironmentVariable("Vault"),
Environment.GetEnvironmentVariable("VaultClientId"),
Environment.GetEnvironmentVariable("VaultClientSecret")
);
var builtConfig = config.Build();
})
.ConfigureServices(services =>
{
// my services here
})
.UseStartup<Startup>()
.Build();
}
public void ConfigureServices(IServiceCollection services)
{
services.AddCors();
// my interfaces here
services.AddAuthentication(sharedOptions =>
{
sharedOptions.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer("Jwt", options =>
{
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
ValidateIssuerSigningKey = true,
ValidIssuer = Configuration["Jwt:Issuer"],
ValidAudience = Configuration["Jwt:Issuer"],
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Environment.GetEnvironmentVariable("JWT_KEY")))
};
})
.AddScheme<AuthenticationSchemeOptions, ApiKeyHandler>("ApiKey", null);
services.AddLogging(builder =>
{
builder.AddConfiguration(Configuration.GetSection("Logging"))
.AddConsole()
.AddDebug();
});
services.AddResponseCaching();
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Title = "MyApp", Version = "v1" });
});
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseCors(builder =>
{
builder.WithOrigins("*")
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.RoutePrefix = string.Empty;
c.SwaggerEndpoint("/swagger/v1/swagger.json", "MyApp");
});
app.UseResponseCaching();
app.UseAuthentication();
app.UseMvc();
}
And here's my web.config also for reference:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore requestTimeout="00:30:00" processPath="dotnet" arguments=".MyApp.dll" stdoutLogEnabled="false" stdoutLogFile=".logsstdout" />
</system.webServer>
</location>
</configuration>
Any help would be appreciated.
.net-core timeout asp.net-core-mvc asp.net-core-webapi
.net-core timeout asp.net-core-mvc asp.net-core-webapi
edited Nov 22 '18 at 17:01
tsw_mik
asked Nov 22 '18 at 16:48
tsw_miktsw_mik
3614
3614
add a comment |
add a comment |
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
});
}
});
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%2f53435341%2ftimeouts-in-net-core-service%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
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%2f53435341%2ftimeouts-in-net-core-service%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