如何维护Azure Web角色之间的表单身份验证会话状态?
我已在 Azure 上部署了启用 RIA 服务的 Silverlight Business 应用程序,该应用程序使用表单身份验证。
为了在 Azure 上启用表单身份验证,我实现了 Azure 工具包中的表存储提供程序。它几乎可以工作,但我在保持会话状态方面遇到问题。登录后,反复按F5刷新页面,在登录和注销之间切换。
我有两个 Web 角色实例,如果我禁用其中一个,它就会发挥作用。但一旦我启用第二个实例,它就会回到这种零星的行为。很明显,由于负载平衡,状态没有被保留。好吧,我忘记实现会话提供程序,所以我这样做了:
<sessionState mode="Custom" customProvider="TableStorageSessionStateProvider">
<providers>
<clear />
<add name="TableStorageSessionStateProvider"
type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageSessionStateProvider"
applicationName="AppAdmin"
/>
</providers>
</sessionState>
遗憾的是,这没有帮助。
更新:实际的表(会话)是在表存储中创建的,但其中没有数据。
有什么想法和/或建议吗?
I have deployed a RIA Services enabled Silverlight Business application on Azure that uses Forms authentication.
To enable Forms authentication on Azure, I have implemented the Table Storage providers from the Azure Toolkit. It almost works, but I have problems with keeping the session state. After I have logged in, and repeatedly presses F5 to refresh the page I switch between being logged in and logged out.
I have two Web Role Instances, and if I disable one of the it works like a charm. But as soon as I enable the second instance it's back to this sporadic behaviour. So clearly the state is not preserved because of the load balancing. Fine, I forgot to implement the Session provider, so I did:
<sessionState mode="Custom" customProvider="TableStorageSessionStateProvider">
<providers>
<clear />
<add name="TableStorageSessionStateProvider"
type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageSessionStateProvider"
applicationName="AppAdmin"
/>
</providers>
</sessionState>
Sadly, that didn't help.
Update: The actual table (Session) is created in the Table Storage, but no data is in there.
Any ideas and/or suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否在 web.config 中设置了机器密钥?
Have you set your machine key in web.config?