【问题标题】:After upgrading to ASP.NET Core 3.0, I get "Could not create stdoutLogFile ErrorCode = -2147024893."升级到 ASP.NET Core 3.0 后,我收到“无法创建 stdoutLogFile 错误代码 = -2147024893”。
【发布时间】:2020-02-18 10:04:12
【问题描述】:

我正在将现有的 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>

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

但是当我调用我的 API 时,我在 Error Viewer 中得到了这个错误:

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

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

【问题讨论】:

    标签: asp.net-core iis web-config asp.net-core-3.0


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-13
      • 1970-01-01
      • 1970-01-01
      • 2020-01-29
      • 1970-01-01
      • 1970-01-01
      • 2020-01-25
      • 2022-08-11
      相关资源
      最近更新 更多