Azure 错误,数据保护操作不成功
Azure Error, The Data Protection Operation was unsuccessful
我在使用 OWIN 并在 Azure 中发布时遇到错误。
当我搜索时,问题出在 IIS 中,其中 LoadUserProfile 为 False
有什么解决办法吗?或 Web.Config 中的任何设置以将 LoadUserProfile 更改为 True?
我建议你看看this blog。以下是一个片段:
WIF protects cookies using DPAPI and the user store. When your app is hosted in IIS, its AppPool must have a specific option enabled (“Load User Profile”) in order for DPAPI to access the user store. In Windows Azure Web Sites, that option is off (with good reasons, it can exact a heavy toll on memory) and you can’t turn it on. But hey, guess what: even if you could, that would be a bad idea anyway. The default cookie protection mechanism is not suitable for load balanced scenarios, given that every node in the farm will have a different key: that means that a cookie protected by one node would be unreadable from the other, breaking havoc with your Web app session.
如果您想 运行 您的应用程序到 Azure Web App,请尝试该博客提到的解决方法。
在我这样使用之前
var user = await UserManager.FindByNameAsync(email);
var token = await UserManager.GeneratePasswordResetTokenAsync(user.Id);
IdentityResult 结果 = await UserManager.ResetPasswordAsync(user.Id, token, vm.NewPassword);
那我就这样改
var user = await UserManager.FindByNameAsync(email);
等待 UserManager.RemovePasswordAsync(user.Id);
IdentityResult 结果 = await UserManager.AddPasswordAsync(user.Id, vm.NewPassword);
希望我的源码能帮到大家
快乐编码
我在使用 OWIN 并在 Azure 中发布时遇到错误。
当我搜索时,问题出在 IIS 中,其中 LoadUserProfile 为 False
有什么解决办法吗?或 Web.Config 中的任何设置以将 LoadUserProfile 更改为 True?
我建议你看看this blog。以下是一个片段:
WIF protects cookies using DPAPI and the user store. When your app is hosted in IIS, its AppPool must have a specific option enabled (“Load User Profile”) in order for DPAPI to access the user store. In Windows Azure Web Sites, that option is off (with good reasons, it can exact a heavy toll on memory) and you can’t turn it on. But hey, guess what: even if you could, that would be a bad idea anyway. The default cookie protection mechanism is not suitable for load balanced scenarios, given that every node in the farm will have a different key: that means that a cookie protected by one node would be unreadable from the other, breaking havoc with your Web app session.
如果您想 运行 您的应用程序到 Azure Web App,请尝试该博客提到的解决方法。
在我这样使用之前
var user = await UserManager.FindByNameAsync(email); var token = await UserManager.GeneratePasswordResetTokenAsync(user.Id); IdentityResult 结果 = await UserManager.ResetPasswordAsync(user.Id, token, vm.NewPassword);
那我就这样改 var user = await UserManager.FindByNameAsync(email); 等待 UserManager.RemovePasswordAsync(user.Id); IdentityResult 结果 = await UserManager.AddPasswordAsync(user.Id, vm.NewPassword);
希望我的源码能帮到大家 快乐编码