首页 > 解决方案 > NET Core 本地 IIS 如何确定应用程序池用户

问题描述

我在 Windows 10 上有 IIS。我在 .NET Core 3.0 中发布了网页,但出现错误:

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

Detailed Error Information:
Module     IIS Web Core
Notification       BeginRequest
Handler    Not yet determined
Error Code     0x8007000d
Config Error       
Config File    \\?\C:\inetpub\wwwroot\myapp\web.config
Requested URL      http://localhost:80/myapp/
Physical Path      C:\inetpub\wwwroot\myapp\
Logon Method       Not yet determined
Logon User     Not yet determined

我在网上查了一下,发现:

https://stackoverflow.com/questions/929131/how-do-i-resolve-http-error-500-19-internal-server-error-on-iis7-0


   Looks like the user account you're using for your app pool doesn't have rights to the web site
 directory, so it can't read config from there. Check the app pool and see what user it is 
configured to run as. Check the directory and see if that user has appropriate rights to it. While 
you're at it, check the event log and see if IIS logged any more detailed diagnostic information 
there.

但我不知道应用程序池中用户的名称是什么。当我输入 DefaultAppPool 和检查名称时,它显示用户不存在。

如何检查该用户?

标签: iis.net-core

解决方案


与此案例类似的错误消息

在此处输入图像描述

https://forums.asp.net/t/2152289.aspx?Problem+occur+when+hosting+ASP+NET+core+2+1+project+locally+on+computer+

请确保已安装 .net core webhosting bundle:

https://docs.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-3.1&tabs=visual-studio

同时,请确保您正在通过 Web 部署工具部署项目。因为手动发布 IIS 不会自动注册 ASPNETCORE 处理程序。

进程内进程和进程外进程将具有不同的处理程序设置。

框架依赖:

<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet"
                  arguments=".\MyApp.dll"
                  stdoutLogEnabled="false"
                  stdoutLogFile=".\logs\stdout"
                  hostingModel="inprocess" />
    </system.webServer>
  </location>
</configuration>

自给自足

<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath=".\MyApp.exe"
                  stdoutLogEnabled="false"
                  stdoutLogFile=".\logs\stdout"
                  hostingModel="inprocess" />
    </system.webServer>
  </location>
</configuration>

https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-3.1


推荐阅读