0
查詢SQL Azure數據庫我有這應該查詢需要更新項目的基於Azure的SQL數據庫的天青工作者的角色,執行計算,並將結果保存。非常簡單的東西,我無法在本地計算機上的Azure計算模擬器中工作,無論是針對LocalDb
還是針對基於Azure的生產數據庫。異常時,從Azure的輔助角色
當在雲中運行,但是我得到下面的異常,我不知道是什麼原因造成:
應用:WaWorkerHost.exe
Framework版本:v4.0.30319
說明:The process was terminated due to an unhandled exception.
例外信息:System.Data.DataException
堆棧:
at System.Data.Entity.Internal.RetryAction`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].PerformAction(System.__Canon)
at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(System.Action`1<System.Data.Entity.Internal.InternalContext>)
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(System.Type)
at System.Data.Entity.Internal.Linq.InternalSet`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].get_InternalContext()
at System.Data.Entity.Infrastructure.DbQuery`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].System.Linq.IQueryable.get_Provider()
at System.Linq.Queryable.Where[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Linq.IQueryable`1<System.__Canon>, System.Linq.Expressions.Expression`1<System.Func`2<System.__Canon,Boolean>>)
at Workzerk.Worker.Events.EventsWorkerRole.Run()
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.StartRoleInternal()
at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<StartRole>b__2()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
這段代碼運行正常(在OnStart方法):
string connectionString = RoleEnvironment.GetConfigurationSettingValue("SampleDbConnectionString");
Trace.TraceInformation("The connection string for the database is: " + connectionString);
_db = new SampleDbContext(connectionString);
正確的連接字符串獲取輸出到日誌。
不幸的是,下面的代碼拋出異常(此代碼在運行方法):
Event[] events = _db.Events.Where(x => x.NextOccurence != null).ToArray();
事件是我們的域對象之一。
有誰知道是什麼原因造成這個異常,或者我如何能夠最好地去尋找呢?
你得到