2012-11-14 104 views
3

我有一個在azure上託管的果園網站連接到一個sql azure數據庫,我一直在獲取沒有行的給定標識符存在[Orchard.Roles.Models.PermissionRecord#33]這裏是堆棧跟蹤。Orchard Azure網站錯誤

[ObjectNotFoundException: No row with the given identifier exists[Orchard.Roles.Models.PermissionRecord#33]] 
NHibernate.Impl.DefaultEntityNotFoundDelegate.HandleEntityNotFound(String entityName, Object id) +56 
NHibernate.Proxy.AbstractLazyInitializer.CheckTargetState() +48 
NHibernate.Proxy.AbstractLazyInitializer.Initialize() +87 
NHibernate.Proxy.DefaultLazyInitializer.Intercept(InvocationInfo info) +85 
PermissionRecordProxy.get_Name() +192 
Orchard.Roles.Services.RoleService.GetPermissionsForRole(Int32 id) +128 
Orchard.Roles.Services.RoleService.GetPermissionsForRoleByNameInner(String name) +37 
Orchard.Roles.Services.<>c__DisplayClasse.<GetPermissionsForRoleByName>b__d(AcquireContext`1 ctx) +26 
Orchard.Caching.Cache`2.CreateEntry(TKey k, Func`2 acquire) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Caching\Cache.cs:57 
Orchard.Caching.<>c__DisplayClass2.<Get>b__0(TKey k) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Caching\Cache.cs:19 
System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey key, Func`2 addValueFactory, Func`3 updateValueFactory) +125 
Orchard.Caching.Cache`2.Get(TKey key, Func`2 acquire) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Caching\Cache.cs:17 
Orchard.Caching.DefaultCacheManager.Get(TKey key, Func`2 acquire) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Caching\DefaultCacheManager.cs:33 
Orchard.Roles.Services.RoleService.GetPermissionsForRoleByName(String name) +100 
Orchard.Roles.Services.RolesBasedAuthorizationService.TryCheckAccess(Permission permission, IUser user, IContent content) +595 
Orchard.Security.Authorizer.Authorize(Permission permission, IContent content, LocalizedString message) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Security\Authorizer.cs:72 
Orchard.Security.Authorizer.Authorize(Permission permission) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Security\Authorizer.cs:60 
Orchard.Security.SecurityFilter.OnAuthorization(AuthorizationContext filterContext) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Security\SecurityFilter.cs:24 
System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor) +97 
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +311 
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__19() +23 
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +19 
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10 
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55 
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +39 
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23 
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55 
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29 
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10 
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25 
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23 
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55 
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +31 
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 
Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in c:\Users\sebros\My Projects\Orchard\src\Orchard\Mvc\Routes\ShellRoute.cs:162 
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9629708 
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 

我在PermissionRecord表查找數據庫,數據庫中根本沒有ID#33。當我將果園網站下載到webmatrix上進行本地開發時,網站根本沒有任何錯誤,並且工作正常,它也正確連接到了sql azure數據庫。所以我有點困惑,爲什麼這在azure上不起作用,因爲它在本地工作,並且應該使用與azure網站上相同的文件,因爲我直接從azure網站下載文件。有人有主意嗎?

回答

3

這已經過期了,但我今天早上在果園1.6遇到了類似的情況。不知道它是怎麼發生的!我希望這可以幫助其他任何碰到同樣問題的人。

(我相信我已經改變了模塊的權限它是很久以前啓用後說好的注意到,直到分配一個破碎的角色給用戶的任何問題)

我用SQL的這一下,找到有問題的記錄:

SELECT  TOP (1000) MyPrefix_Orchard_Roles_RolesPermissionsRecord.Id, MyPrefix_Orchard_Roles_RolesPermissionsRecord.Role_id, 
        MyPrefix_Orchard_Roles_RolesPermissionsRecord.Permission_id, MyPrefix_Orchard_Roles_RolesPermissionsRecord.RoleRecord_Id, 
        MyPrefix_Orchard_Roles_RoleRecord.Name AS RoleName, MyPrefix_Orchard_Roles_PermissionRecord.Name AS PermissionName, 
        MyPrefix_Orchard_Roles_PermissionRecord.FeatureName AS PermissionFeatureName, 
        MyPrefix_Orchard_Roles_PermissionRecord.Description AS PermissionDescription 
FROM   MyPrefix_Orchard_Roles_RolesPermissionsRecord LEFT OUTER JOIN 
         MyPrefix_Orchard_Roles_PermissionRecord ON 
         MyPrefix_Orchard_Roles_RolesPermissionsRecord.Permission_id = MyPrefix_Orchard_Roles_PermissionRecord.Id LEFT OUTER JOIN 
         MyPrefix_Orchard_Roles_RoleRecord ON MyPrefix_Orchard_Roles_RolesPermissionsRecord.Role_id = MyPrefix_Orchard_Roles_RoleRecord.Id 
WHERE  (MyPrefix_Orchard_Roles_RolesPermissionsRecord.Role_id = 1) -- broken administrator role 

發現有兩條記錄缺少許可記錄。其中一個將RoleRecord_Id設置爲NULL,另一個設置爲1 - 管理員。所以當用admin加載權限時,查找權限記錄時會失敗。這有助於部分記錄。

管理員中的幾個角色部分仍然顯示爲「Admin/Roles」,因此我運行上面的sql腳本以查找來自不同角色的更多有問題的行。

我認爲隨機行不會導致任何問題,其他一切似乎都能按預期工作。

謝謝,馬特