首页 > 解决方案 > 升级到 ASP.NET Core 3.0 后,我得到“无法创建 stdoutLogFile 错误代码 = -2147024893”。

问题描述

我正在将现有的 ASP.NET Core 2.2 应用程序升级到3.0.

当我在本地 IIS 中发布和托管我的 API 时,我收到HTTP 错误 502.5 - 进程失败页面。关键是,我没有看到正在写入该stdoutLogFile位置的日志。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\bin\MyApplication.dll" stdoutLogEnabled="true" stdoutLogFile=".\bin\Logs\" hostingModel="inprocess" />
  </system.webServer>
</configuration>

我已通过以下配置将输出文件夹从\bin\Debug\netcoreapp3.0\更改为:\bin\

<PropertyGroup>
    <OutputPath>.\bin</OutputPath>
    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
    <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
</PropertyGroup>

Logs我的文件夹中还有一个文件\bin\夹。

但是当我调用我的 API 时,我在错误查看器中收到此错误:

警告:无法创建 stdoutLogFile C:\PathToMyProjectFile\bin\Debug\netcoreapp2.2_19212_2019102292022.log,错误代码 = -2147024893。

关键是,我不再使用 2.2。我应该如何解决这个问题?

标签: asp.net-coreiisweb-configasp.net-core-3.0

解决方案


您必须通过删除 modules="AspNetCoreModuleV2" 中的 "V2" 来修改生成的 web.config,以便拥有: modules="AspNetCoreModule"。希望这可以帮助


推荐阅读