2
我在sitefinity中做了一些後臺線程任務。以前我在線上得到例外。引用的OpenAccessContext或'IObjectScope'已經關閉(UnsynchronizedPMProxy)
Config.Get()。ConnectionStrings。爲了克服它,我已發送虛擬ashx請求到我的網站,並能夠獲得連接字符串和連接ot數據庫。
現在試圖在通過代碼
訪問DynamicContent類DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
Type itemType = TypeResolutionService.ResolveType(key);
DynamicContent item = dynamicModuleManager.GetDataItem(itemType, id);
return item;
我收到上述錯誤。
任何想法如何克服這個被引用的OpenAccessContext或'IObjectScope'已經關閉(UnsynchronizedPMProxy)。錯誤?
感謝Veseline。 我已經嘗試過,但不能始終工作。例如,如果我在應用程序啓動中啓動一些後臺任務,則會引發錯誤(除非讓該線程休眠一段時間) –
在這種情況下,Config可能尚未初始化。確保你在Bootstrapper.Initialized事件中執行它。更多關於它的信息,請訪問: http://www.sitefinity.com/documentation/documentationarticles/developers-guide/sitefinity-essentials/modules/ecommerce/processing-hooks/preprocessorder-event –