1
我是小失物......失去從會議間歇
我們使用SQLSERVER會話共享和我們的生產(2臺服務器)和分期(2臺服務器),我只是從會議間歇性地失去一個項目。分段和生產都是負載平衡的,並且在相同的服務器上,但指向不同的數據庫。
我的本地開發和dev站點(不同的服務器)沒有這個問題。這些都使用開發數據庫。
Sql服務器會話表和sprocs特定於環境,因爲它們是在dev,staging或生產數據庫中設置的。
代碼放置在會議
SessionService.AddItem(SessionKeys.LoggedInUser, user); //this is always available
SessionService.AddItem(SessionKeys.Impersonator, inhouseUser); //this is lost intermittently
public static void AddItem(string key, object value)
{
CheckSessionAvailability();
HttpContext.Current.Session[key] = value;
}
獲取項目從會議內容:
User inhouseUser = SessionService.GetItem<User>(SessionKeys.Impersonator);
public static T GetItem<T>(string key)
{
object item = null;
CheckSessionAvailability();
item = HttpContext.Current.Session[key];
if ((item != null) && !(item is T))
{
throw new ApplicationException("Cannot convert");
}
return (T)item;
}
你有沒有在web.config中定義的機器密鑰? – Fredou 2014-09-04 17:27:27
是 –
2014-09-04 17:36:14
我已經回收應用程序池並重新啓動暫存站點。這沒有幫助。 – 2014-09-04 17:49:57