添加自定义错误页面时 IIS 7.5 管理器崩溃

添加自定义错误页面时 IIS 7.5 管理器崩溃

我在 Win 7 Pro 中运行本地 IIS 7.5 服务器,并且正在尝试为 403 响应添加自定义错误页面。

当我单击“确定”为我的站点添加自定义错误页面时,IIS 管理器就消失了。服务器仍在运行,我可以重新启动 IIS 管理器,但新页面尚未保存。

我也尝试过直接将其添加到 web.config,但这只是给我The page cannot be displayed because an internal server error has occurred.

有人知道为什么会发生这种情况吗?

编辑:
事件日志暗示路径中的无效字符导致了崩溃,但即使我从有效条目中复制并粘贴路径时也会发生崩溃。

应用程序错误日志:

IISMANAGER_CRASH

IIS Manager terminated unexpectedly.

Exception:System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---     System.ArgumentException: Illegal characters in path.
   at System.IO.Path.CheckInvalidPathChars(String path)
   at System.IO.Path.IsPathRooted(String path)
   at Microsoft.Web.Management.Iis.CustomErrors.CustomErrorsForm.OnAccept()
   at Microsoft.Web.Management.Client.Win32.TaskForm.OnOKButtonClick(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at Microsoft.Web.Management.Host.UserInterface.ManagementUIService.ShowDialogInternal(Form form, IWin32Window parent)
   at Microsoft.Web.Management.Host.UserInterface.ManagementUIService.Microsoft.Web.Management.Client.Win32.IManagementUIService.ShowDialog(DialogForm form)
   at Microsoft.Web.Management.Client.Win32.ModulePage.ShowDialog(DialogForm form)
   at Microsoft.Web.Management.Iis.CustomErrors.CustomErrorsPage.AddCustomError()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.Web.Management.Client.TaskList.InvokeMethod(String methodName, Object userData)
   at Microsoft.Web.Management.Host.UserInterface.Tasks.MethodTaskItemLine.InvokeMethod()
   at System.Windows.Forms.LinkLabel.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Label.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at Microsoft.Web.Management.Host.Shell.ShellApplication.Execute(Boolean localDevelopmentMode, Boolean resetPreferences, Boolean resetPreferencesNoLaunch)

Process:InetMgr

答案1

当我尝试设置选项“将静态文件的内容插入到错误响应中”的路径以及选项“尝试以客户端语言返回错误文件”时,我遇到了类似的问题。

我的目标是设置路径如下 - %SystemDrive%\inetpub\custerr\\404.htm

'<'LANGUAGE-TAG'>' 导致错误并且 IIS 管理器消失。

解决方案:-

  1. 选中“尝试以客户端语言返回错误文件”
  2. 单击第一步后出现的“设置”按钮。
  3. 输入 %SystemDrive%\inetpub\custerr\ 作为根目录路径
  4. 输入 404.htm 作为相对文件路径
  5. 单击对话框中的“确定”
  6. 单击编辑自定义错误页面对话框上的“确定”

答案2

我找到了这个问题的答案:

我需要在服务器级别而不是站点级别添加新的错误页面。

我不知道为什么这会导致 IIS 管理器关闭,但至少有一种方法可以解决这个问题。

相关内容