我编写了一个Windows服务,它产生了一个单独的进程.此过程创建一个COM对象.如果服务在"本地系统"帐户下运行,一切正常,但如果服务在"网络服务"帐户下运行,则外部进程启动但无法创建COM对象.从COM对象创建返回的错误不是标准的COM错误(我认为它特定于正在创建的COM对象).
那么,我如何确定"本地系统"和"网络服务"这两个帐户的区别?这些内置帐户看起来非常神秘,似乎没有人知道它们.
我发现在某些情况下我可以在调试时编辑源代码,使用Visual Studio内置的Web服务器而不是IIS中的虚拟目录有什么其他优点吗?
我在我的开发环境中使用Windows XP,以及IIS 5的本地实例.我在几个项目上工作,因此我使用多个虚拟目录来管理所有不同的站点.
有什么缺点吗?
如果我在服务器上运行应用程序,而不是在本地运行应用程序,则会出现此错误.为什么这发生在服务器而不是本地?
List<GroupPrincipal> result = new List<GroupPrincipal>();
// establish domain context
PrincipalContext yourDomain = new PrincipalContext(ContextType.Domain);
// find your user
UserPrincipal user = UserPrincipal.FindByIdentity(yourDomain, userName);
// if found - grab its groups
if (user != null)
{
//here happens the error on server.
PrincipalSearchResult<Principal> groups = user.GetAuthorizationGroups();
Run Code Online (Sandbox Code Playgroud)
请帮我.
堆栈跟踪:
[PrincipalOperationException: While trying to retrieve the authorization groups, an error (5) occurred.]
System.DirectoryServices.AccountManagement.AuthZSet..ctor(Byte[] userSid, NetCred credentials, ContextOptions contextOptions, String flatUserAuthority, StoreCtx userStoreCtx, Object userCtxBase) +317263
System.DirectoryServices.AccountManagement.ADStoreCtx.GetGroupsMemberOfAZ(Principal p) +441
System.DirectoryServices.AccountManagement.UserPrincipal.GetAuthorizationGroupsHelper() +78
System.DirectoryServices.AccountManagement.UserPrincipal.GetAuthorizationGroups() +11 …Run Code Online (Sandbox Code Playgroud) 在开发过程中,我通常使用Web Development Server(有时称为Cassini)测试ASP.Net应用程序.有时,当我发布到真正的IIS环境时,我注意到应用程序的行为有所不同.
那么,生产IIS服务器和ASP.Net Web开发服务器的行为方式有何不同?我并不是说功能集的差异(显然IIS有许多WDS中没有的功能),但它们处理ASP.Net的方式不同.
顺便说一句:对这个问题的回答中提到了一些差异,但我确信必须有更多.