asp.net - 每次我回来时我的网站都会注销
问题描述
我正在开发一个 asp.net core 2 web 应用程序。出于某种原因,当我有一段时间(即 1 小时)没有进入时,它会被注销
这是我的 web.config:
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Ojete.UI.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
由于我不知道这是如何发生的,我不知道我应该发布代码的另一部分。对于那个很抱歉!
解决方案
请试试这个
services.AddAuthentication()
.Services.ConfigureApplicationCookie(options =>
{
options.SlidingExpiration = true;
options.ExpireTimeSpan = TimeSpan.FromMinutes(30); // here you can change timeout
});
推荐阅读
- python - Flake8:如何将选项传递给旧版 api?
- c# - 将 localhost 端口设置为环境变量
- excel - SSIS 包在环境之间的行为不同
- spring-security - @ManagementContextConfiguration 与 WebSecurityConfigurerAdapter 一起使用不起作用
- xml - 如何在控制台上显示 XML http-response 或其任何值
- text - 指代人类的英语单词列表
- c# - 加入之前创建的光子房间时如何同步数据?
- reactjs - 为什么 react 组件中的 graphQLErrors 总是空的?
- node.js - 覆盖 ReactJS 中的根路径
- angular - 未定义的角度问题