当你的才华不能撑起你的野心时,就是你该选择学习的时候了!

Admin.Net部署:HTTP 错误 500.0 - ASP.NET Core IIS 托管失败(进程内)

HTTP 错误 500.0 - ASP.NET Core IIS 托管失败(进程内)
故障排除步骤:
检查系统事件日志中是否有错误消息
启用记录应用程序进程的 stdout 消息
将调试器附加到应用程序进程并检查
有关诊断和处理这些错误的更多指导,请访问排查 Azure 应用服务和 IIS 上的 ASP.NET Core 问题。

--

IIS URL 重写下载地址:https://download.microsoft.com/download/1/2/8/128E2E22-C1B9-44A4-BE2A-5859ED1D4592/rewrite_amd64_zh-CN.msi

--

Windows 日志-应用程序 报错信息:

1、Failed to start application '/LM/W3SVC/2/ROOT', ErrorCode '0x8007023e'.

2、Application 'E:\code\BackEnd\be-chxpt\Admin.NET\Admin.NET.Web.Entry\bin\Release\net9.0\' failed to start. Exception message:

  Executable was not found at 'E:\code\BackEnd\be-chxpt\Admin.NET\Admin.NET.Web.Entry\bin\Release\net9.0\%LAUNCHER_PATH%.exe'

 

web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <security>
            <requestFiltering>
                <requestLimits maxAllowedContentLength="1073741824" maxQueryString="1073741824" />
            </requestFiltering>
        </security>
        <handlers>
            <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
        </handlers>
        <aspNetCore
            processPath="%LAUNCHER_PATH%"
            arguments="%LAUNCHER_ARGS%"
            stdoutLogEnabled="true"
            stdoutLogFile=".\logs\stdout"
            hostingModel="InProcess">
            <handlerSettings>
                <handlerSetting name="experimentalEnableShadowCopy" value="true" />
                <handlerSetting name="shadowCopyDirectory" value="../ShadowCopyDirectory/" />
                <!-- Only enable handler logging if you encounter issues-->
                <!--<handlerSetting name="debugFile" value=".\logs\aspnetcore-debug.log" />-->
                <!--<handlerSetting name="debugLevel" value="FILE,TRACE" />-->
            </handlerSettings>
        </aspNetCore>
    </system.webServer>
</configuration>

 

解决办法:

手动修改节点值:

<aspNetCore 
  processPath="dotnet" 
  arguments=".\Admin.NET.Web.Entry.dll"  <!-- 替换为你的入口 DLL -->
  stdoutLogEnabled="true" 
  stdoutLogFile=".\logs\stdout" />

关键参数说明:
  processPath 可执行文件路径(如 dotnet 或完整 .exe 路径)
  arguments 启动参数(如 .\YourApp.dll)
  stdoutLogEnabled 是否启用日志(建议 true 用于调试)
  stdoutLogFile 日志文件路径(需手动创建 logs 目录)

 

posted @ 2025-04-19 03:29  hofmann  阅读(137)  评论(0)    收藏  举报