【发布时间】:2013-02-08 05:26:50
【问题描述】:
我是 .NET 开发的新手,通常担任 DBA。
我使用 c# 在 .NET 3.5 中开发了一个网站。该网站用于查询带有密码信息的数据库。我相信错误在于我的 IIS 设置或我的 web.config 文件,而不是我的 c# 代码,但我可能错了。
我得到错误:
Unknown error (0x5011)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Unknown error (0x5011)
Line 40: UserPrincipal user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, VerifiedUser);
Line 41:
Line 42: foreach (var group in user.GetGroups())
Line 43: {
Line 44:
Stack Trace:
[COMException (0x5011): Unknown error (0x5011)]
System.DirectoryServices.ResultsEnumerator.MoveNext() +437216
System.DirectoryServices.AccountManagement.ADDNLinkedAttrSet.GetNextSearchResult() +195
System.DirectoryServices.AccountManagement.ADDNLinkedAttrSet.MoveNextMemberSearcher() +57
System.DirectoryServices.AccountManagement.ADDNLinkedAttrSet.MoveNext() +102
System.DirectoryServices.AccountManagement.ADDNConstraintLinkedAttrSet.MoveNext() +55
System.DirectoryServices.AccountManagement.FindResultEnumerator`1.MoveNext() +106
System.DirectoryServices.AccountManagement.FindResultEnumerator`1.System.Collections.IEnumerator.MoveNext() +9
_Default.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\PasswordVault\Default.aspx.cs:42
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
System.Web.UI.Control.OnLoad(EventArgs e) +132
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
它在我的本地计算机(Windows 7)上总是可以正常工作,但是当我使用 IIS 7 传输到 Windows Server 2008 并将文件存储在 inetpub 的 wwwroot 文件夹中时,我会收到此间歇性错误。
我今天有错误,但昨天没有,但前一天就出现了。我花了几个小时修改 IIS 设置和应用程序池,但我真的需要知道是什么导致了问题。
不喜欢的代码是检查用户是否是特定 AD 组的成员,如果是,则返回基于该用户组的信息。我不相信代码是一个问题,因为它确实(有时)并且总是在我的本地机器上工作。我相信这个问题与 IIS 或 .NET 框架有关。
任何帮助将不胜感激。
问候 约翰
【问题讨论】:
-
我应该添加我的服务器为 .NET 3.5 安装了最新的 SP 和修补程序。
-
您的 Windows 机器上的 IIS 版本是什么?究竟是什么异常,您发布的内容是无用的,因为它是未处理的异常。此外,堆栈跟踪也会有所帮助。如果这是一个间歇性错误,为什么不捕获并记录异常原因?
-
是IIS7。我已经用堆栈跟踪更新了帖子 - 谢谢。
-
您是否将 Windows 7 IIS7 安装中的设置复制到服务器上?
-
它是在 Visual Web 开发人员中使用 IIS Express 开发的,所以我没有相同的界面来检查这些设置。抱歉含糊其辞,也许应该在周末阅读 IIS。
标签: c# asp.net .net iis-7 application-pool