ASP.NET 5 Identity 3 用户在应用程序重启后注销

ASP.NET 5 Identity 3 users get signed out after application restart

我们正在使用 ASP.NET 身份 3。

我们的用户会随机自动注销。为了重现这个问题,我尝试重新启动应用程序,所有用户都注销了,甚至那些勾选了 Remember me.

的用户

它只发生在生产环境中,在开发环境中工作正常。

更新:

我们只有一台生产服务器。

生产机器可能正在使用多个服务器。在这种情况下,用户首先连接到的服务器可能与该用户后来连接到的服务器不同。在这种情况下,如果您使用会话 ID,则必须使用户会话在服务器之间保持同步。

在这种情况下,您将需要 configure data protection in the production server. I assume that in your local machine the website runs as a local user so the registry hives can be created and read. While if you run it as a user without a local profile (default IIS app pool user option), it may not have the permission/s to create or read the keys required. You'll need to run this provisioning script

好好阅读他们在 Publishing to IIS. That step is documented there 上的指南。