因此,基本上,我已经使用.NetCore创建了一个工具来对文件执行某些操作。但是用户抱怨说,经过几分钟(约3-4分钟)后,所有按钮都停止响应,好像IDLE超时已损坏,或者KeepAliveTimeout中断了,因为这些按钮在会话开始时就起作用了。我究竟做错了什么?
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseUrls($"http://localhost:{port}")
.UseKestrel(o => o.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(20))
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
.ConfigureServices((services) =>
{
services.AddDbContext<StatsDbContext>(options =>
options.UseMySQL(connStr));
services.AddSession(options => {
options.IdleTimeout = TimeSpan.FromMinutes(180);
options.Cookie.Name = "app1";
});
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
})
.Build();