使用 SQL Server 和 TempData MVC 进行负载平衡
有人告诉我,在使用 SQL Server 时,MVC 1.0 TempData 无法在负载均衡器下工作,这是因为字典本身不可序列化。
我们的项目需要此功能,并且希望能够有效地进行负载平衡。
因此,如果有人能够回答以下问题,我将不胜感激: 有什么办法可以让它发挥作用吗? MVC 2.0 中修复了这个问题吗? 我们可以创建一个 ITempDataProvider 来修复它吗? 或者是否有人修复了他们想要分享的自己项目的源代码?
干杯, 杰米
I've been told that MVC 1.0 TempData does not work under a load balancer when using SQL Server and that it is because the Dictionary itself is not serializable.
We require this for a project and are looking to be able load balancer effectively.
So I would be very grateful if someone could answer the following questions:
Is there away around this so you can make it work?
Is this fixed in MVC 2.0?
Can we create a ITempDataProvider to fix it?
Or has anyone made a fix to the source code for a project of their own they would like to share?
Cheers,
Jamie
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
字典本身不需要可序列化。您存储在 TempData 中的内容需要可序列化。例如,如果您有以下类,
您可以完美地使用 SQL Server 进行会话持久性并编写以下代码:
The dictionary itself doesn't need to be serializable. It is what you store inside
TempData
that needs to be serializable. So for example if you have the following classYou can perfectly fine use SQL server for session persistence and write the following code:
嗯,那么任何 UI 模型 (ASP.Net MVC) 都只需要 Serialized 属性并且应该可以工作吗?
它如何适用于基于列表和集合的 UI 模型?
Mmmm, so any UI model (ASP.Net MVC) would just require the Serializable attribute and that should just work?
How does it work for lists and collection based UI models?