Orchard Azure网站错误

时间:2012-11-14 17:02:39

标签: azure orchardcms azure-sql-database azure-web-sites

我有一个托管在azure上的果园网站连接到一个sql azure数据库,我一直得到没有给定标识符存在的行[Orchard.Roles.Models.PermissionRecord#33]这里是堆栈跟踪。

[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网站下载文件。有人有什么想法吗?

1 个答案:

答案 0 :(得分: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时,查找权限记录将失败。这有助于记录部分。

管理员中的一些角色部分似乎仍然破碎:“管理员/角色”所以我运行上面的sql脚本以查找来自不同角色的更多违规行。

我认为随机行不会导致任何问题,其他一切似乎再次按预期工作。

谢谢,马特