gpt4 book ai didi

azure - Orchard Azure 网站错误

转载 作者:行者123 更新时间:2023-12-01 09:09:23 27 4
gpt4 key购买 nike

我在 azure 上托管了一个 orchard 网站,已连接到 sql azure 数据库,我一直收到 No row with the给定标识符存在[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。当我将 orchard 网站下载到 webmatrix 进行本地开发时,该网站完全没有给我任何错误并且工作正常,它也正确连接到 sql azure 数据库。所以我有点困惑为什么这在 azure 上不起作用,因为它在本地工作,并且应该使用与 azure 网站上相同的文件,因为我直接从 azure 网站下载了文件。大家有什么想法吗?

最佳答案

这已经很晚了,但今天早上我在 orchard 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 - 管理员。因此,当使用管理员加载权限时,查找权限记录将失败。这在一定程度上帮助了日志记录。

管理中的几个角色部分似乎仍然损坏:“管理/角色”,因此我运行上面的 sql 脚本来查找来自不同角色的更多违规行。

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

谢谢,马特

关于azure - Orchard Azure 网站错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13383569/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com