You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多
文档控制台
免费开始使用

无需重装系统修复空白IIS管理器及本地服务器配置异常问题求助

无需重装系统修复空白IIS管理器及本地服务器配置异常问题求助

各位大佬,我实在被一个IIS问题搞到头大了,折腾好几天都没解决,来这儿求支招!

事情是这样的:我在一台新机器上安装IIS后,打开IIS管理器发现根本没有列出本地服务器,也找不到添加的入口

我已经试过各种常规操作了:

  • 卸载IIS,手动删除inetpubinetserv文件夹后重装
  • 用DISM命令修复系统:DISM.exe /Online /Cleanup-image /Restorehealth
  • 运行sfc扫描:sfc /scannow
  • 尝试过各种命令行方式的卸载、重装流程,每一步操作后都重启了机器,还安装了所有Windows更新

但不管怎么折腾,IIS管理器窗口始终是空的。偶尔“主页”按钮不会变灰,但点击后会触发应用事件日志里的报错,具体信息如下:

The description for Event ID 13 from source Microsoft-Windows-IIS-IISManager cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

IISMANAGER_CRASH

IIS Manager terminated unexpectedly.

对应的异常堆栈我贴在代码块里:

Exception:System.NullReferenceException: Object reference not set to an instance of an object.

at Microsoft.Web.Management.Host.UserInterface.ManagementFrame.NavigateToHomepage(Boolean connectionReactivating)

at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)

at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)

at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)

at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)

at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)

at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ToolStrip.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(IntPtr 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

The system cannot find the file specified

我也检查了网站访问情况:

  • 浏览器访问http://localhost直接返回404
  • appcmd.exe能查看服务器状态,但默认网站的配置明显不对:
    • 之前正常安装时应该有3个默认应用池,但现在只剩一个:
      >appcmd.exe list apppool
      APPPOOL "DefaultAppPool" (MgdVersion:v4.0,MgdMode:Integrated,state:Started)
      
    • 默认网站的绑定为空,状态显示Unknown,根本启动不了:
      >appcmd.exe list sites
      SITE "Default Web Site" (id:1,bindings:,state:Unknown)
      
      >appcmd.exe start site "Default Web Site"
      ERROR ( hresult:800710d8, message:Command execution failed.
      The object identifier does not represent a valid object.
      )
      

我尝试手动修复网站配置,但都没效果:

  • 添加绑定后网站能启动,但访问变成空白页,返回401:
    >appcmd.exe set site "Default Web Site" /bindings:"http://localhost:80"
    >appcmd.exe list sites
    SITE "Default Web Site" (id:1,bindings:http/*:80:localhost,state:Started)
    
  • 手动设置物理路径到wwwroot
    >appcmd.exe set vdir "Default Web Site/" -physicalPath:"%SystemDrive%\inetpub\wwwroot"
    VDIR object "Default Web Site/" changed
    
  • 指定应用池:
    >appcmd.exe set app "Default Web Site/" /applicationPool:"DefaultAppPool"
    APP object "Default Web Site/" changed
    
  • 开启匿名认证:
    >appcmd.exe set config "Default Web Site" -section:system.webServer/security/authentication/anonymousAuthentication /enabled:"True" /commit:apphost
    Applied configuration changes to section "system.webServer/security/authentication/anonymousAuthentication" for "MACHINE/WEBROOT/APPHOST/Default Web Site" at configuration commit path "MACHINE/WEBROOT/APPHOST"
    

这些操作都没解决401的问题,而且最奇怪的是,不管我卸载重装多少次,甚至删除了相关文件夹,默认网站的配置依然是坏的。

另外,IIS相关服务启动停止都正常,iisreset这类命令也能正常执行,就是管理器和网站配置的问题一直存在。

2022年12月13日更新:我折腾了几次卸载重装,终于装上了IIS远程管理工具,能连接到本地服务器,但之前安装的其他IIS功能都不见了(卸载重装也没用)。甚至连匿名认证都找不到,这可能和一直出现的401错误有关?

现在我实在没辙了,想问问各位:

  • 有没有人遇到过完全一样的问题并解决了?
  • 有没有其他日志可以排查根因?
  • 还有什么修复方法我没试过?

真的不想重装系统,跪求各位大佬支招!

备注:内容来源于stack exchange,提问作者TheXenocide

火山引擎 最新活动