HTTP 错误 500.19 - 内部服务器错误 0x80070003 无法读取配置文件

HTTP Error 500.19 - Internal Server Error 0x80070003 Cannot read configuration file

当我发布我的应用程序并将其从开发服务器转移到生产服务器时,我遇到了上述错误。以下是错误详情。

Detailed Error Information

Module IIS Web Core

Notification BeginRequest

Handler Not yet determined

Error Code 0x80070003

Config Error Cannot read configuration file

Config File \?\C:\inetpub\wwwroot\WorkmenCompTest\web.config

Requested URL http://localhost:80/wictest

Physical Path C:\inetpub\wwwroot\WorkmenCompTest

Logon Method Not yet determined

Logon User Not yet determined

该网站以前可以正常工作,但最近发布的版本由于这个错误而停止工作。据我所知,唯一的变化是通过 nuget 安装 iTextSharp 和 iTextSharp xmlworker。

我试过了,没有成功:

  1. 将站点文件夹的修改权限授予所有人
  2. 检查 web.config 文件,并使用旧版本的 web.config 文件(从站点运行时开始)。
  3. 正在卸载 iTextSharp 和 iTextSharp XMLWorker

该项目从 Visual Studio 开始仍然运行没有问题。

DefaultAppPool 应用程序池在网络服务帐户下运行。此帐户在计算机本地,并且此帐户不存在于另一台计算机上。确保将 DefaultAppPool 应用程序池配置为使用域用户帐户。然后,您可以在 WorkmenComp 文件服务器上使用相同的帐户。或者,您可以在 WorkmenComp 文件服务器上创建一个工作组帐户。

已解决。该错误是由文件夹名称与虚拟目录的路径不匹配引起的。哇哦,我觉得很蠢。

这是因为IIS.To更改了应用程序内容的物理路径

中的不同物理路径

您可以通过使用用户界面 (UI)、通过命令行中的 运行 Appcmd.exe 命令 window、通过编辑配置文件来执行此过程直接,或通过编写 WMI 脚本。 用户界面 要使用 UI

Open IIS Manager. For information about opening IIS Manager, see Open IIS Manager (IIS 7).

In the Connections pane, expand the Sites node and click to select the site in which your application runs.

In the Actions pane, click View Applications.

On the Applications feature page, select an application from the list and then click Basic Settings in the Actions pane.

In the Physical path box, change the path of the application content.

Click OK.

检查应用程序根目录下 - .vs\lpsWeb-UI\config 文件夹下的 applicationhost.config 文件。

在配置文件的站点部分下检查物理路径指向什么。

如果您修改这些内容,您应该能够解决问题。