我正在尝试将工作的 S#arp Architecture MVC 应用程序从具有网络服务身份的应用程序池切换到具有域用户身份的应用程序池。我在 Web 服务器中的用户上运行 aspnet_regiis 并授予用户访问数据库的权限(甚至尝试将其设置为数据库中的系统管理员)。但是,它似乎无法获得 NHibernate 会话。
Exception information:
Exception type: NullReferenceException
Exception message: Object reference not set to an instance of an object.
Request information:
Request URL: http://<redacted>
Request path: /<redacted>
User host address: 10.10.10.10
User: <webuser>
Is authenticated: True
Authentication Type: Forms
Thread account name: <MYDOMAIN\MYUSER>
Thread information:
Thread ID: 1
Thread account name: <MYDOMAIN\MYUSER>
Is impersonating: False
Stack trace: at SharpArch.Data.NHibernate.NHibernateSession.get_Current() in C:\MyStuff\Dev\Projects\SharpArchitecture\src\SharpArch\SharpArch.Data\NHibernate\NHibernateSession.cs:line 88
at UserAccount.Persistence.UserRepository.GetByPropertiesPartialMatching(IDictionary`2 exactMatchPropertyValuePairs, IDictionary`2 partialMatchPropertyValuePairs, MatchMode matchMode) in c:\Persistence\UserRepository.cs:line 66
...
在 SharpArch NHibernateSession.cs 中给出 Null 引用异常的实际行是:
ISession session = Storage.Session;