我有一个ASP.NET应用程序在我的服务器上工作正常,直到昨晚我安装了一堆Windows更新,现在它抛出了这个异常:
System.Security.SecurityException: Requested registry access is not allowed.
不幸的是,有一些事情使得这很难调试。我将debug =“true”属性添加到web.config文件中以获取推送异常的行。我的代码中标识的行是End If,之前的代码似乎是良性的:
<body id="body" runat="server">
<div class="conteneur-confirmation">
<%
If Not Session("confirmation") Is Nothing Then
Response.Write("<ul><li>" & Session("confirmation") & "</li></ul>")
Session.Remove("confirmation")
End If
%>
</div>
<div class="conteneur-alerte">
<%
If Not Session("Alerte") Is Nothing Then
Response.Write("<ul><li>" & Session("Alerte") & "</li></ul>")
Session.Remove("Alerte")
End If <!-- The exception is supposedly launch from here -->
%>
<!-- more code -->
我强硬的下一件事可以帮助我的是堆栈跟踪。这是:
[SecurityException: Accès au registre demandé non autorisé.]
System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) +52
Microsoft.Win32.RegistryKey.InternalOpenSubKey(String name, RegistryKeyPermissionCheck permissionCheck, Int32 rights) +9434757
Microsoft.Win32.RegistryKey.OpenSubKey(String name, RegistryKeyPermissionCheck permissionCheck, RegistryRights rights) +15
System.TimeZoneInfo.TryCompareTimeZoneInformationToRegistry(TimeZoneInformation timeZone, String id, Boolean& dstDisabled) +234
System.TimeZoneInfo.FindIdFromTimeZoneInformation(TimeZoneInformation timeZone, Boolean& dstDisabled) +258
System.TimeZoneInfo.GetLocalTimeZone() +307
System.TimeZoneInfo.get_Local() +116
System.DateTime.ToLocalTime() +60
System.IO.File.GetLastWriteTime(String path) +34
System.Web.Handlers.AssemblyResourceLoader.GetAssemblyInfoWithAssertInternal(Assembly assembly) +93
System.Web.Handlers.AssemblyResourceLoader.GetAssemblyInfo(Assembly assembly) +67
System.Web.Handlers.AssemblyResourceLoader.GetWebResourceUrlInternal(Assembly assembly, String resourceName, Boolean htmlEncoded, Boolean forSubstitution, IScriptManager scriptManager) +1159
System.Web.Handlers.AssemblyResourceLoader.GetWebResourceUrl(Type type, String resourceName, Boolean htmlEncoded, IScriptManager scriptManager) +722
System.Web.UI.ClientScriptManager.GetWebResourceUrl(Page owner, Type type, String resourceName, Boolean htmlEncoded, IScriptManager scriptManager) +167
System.Web.UI.ClientScriptManager.RenderWebFormsScript(HtmlTextWriter writer) +158
System.Web.UI.Page.RenderWebFormsScript(HtmlTextWriter writer) +58
System.Web.UI.Page.BeginFormRender(HtmlTextWriter writer, String formUniqueID) +8910479
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +57
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +31
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +53
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
ASP.masters_sigiweb2_master.__Renderbody(HtmlTextWriter __w, Control parameterContainer) in C:\Inetpub\v3\Masters\sigiweb2.master:96
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +31
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8431
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +253
System.Web.UI.Page.ProcessRequest() +78
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.default_aspx.ProcessRequest(HttpContext context) +37
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
当System.TimeZoneInfo.TryCompareTimeZoneInformationToRegistry尝试访问注册表并且asp.net身份IWAM_MACHINENAME没有权限时,看起来异常是启动。我想,其中一个Windows更新改变了某些注册表项的权限或此功能的行为。我在网上搜索了“TryCompareTimeZoneInformationToRegistry”,认为我会找到一个与我有同样错误的人。但是谷歌只返回两页参考这个功能,它们都是意大利语。
我想解决方案只是简单地改变对注册表某些部分的访问权限,但我不知道哪个,似乎网上几乎没有关于此功能的信息(很奇怪,没有?)。
我想补充一点,我的服务器是法语版的Windows Server 2003.那个以及我在互联网上找到的关于它的唯一其他信息是意大利语让我觉得它可能是一个不会出现的问题发生在英文版的Windows上,但我无法证实这一点。
感谢您的帮助。
答案 0 :(得分:1)
注册表项HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\TimeZones\Bangladesh Standard Time
的权限设置错误(可能是我刚刚完成的Windows Update导致的问题)。我只是复制了另一个时区密钥的权限,这对每个人都是正确的,问题就消失了。
现在,我希望Google会在这里向人们发送此问题。在网上找到几乎没有关于TryCompareTimeZoneInformationToRegistry函数的信息有点奇怪。
答案 1 :(得分:-1)
该页面显示该问题是由阻止访问注册表的防病毒软件引起的。这听起来像是一个合理的起点。