.NET Core Azure -HTTP错误500.0-内部服务器错误

发布于 2025-01-22 02:46:10 字数 2611 浏览 0 评论 0原文

我正在尝试在Azure中发布我的.NET Core Web应用程序,我设法使用GitHub Action发布了我的项目。 另外,我还创建了一个Azure SQL数据库(我使用AppSettings配置了Azure SQL数据库的ASP .NET Core应用程序,但我也将连接字符串添加在Azure Web应用程序的配置中)。

web.config content

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

在Azure服务日志中,我得到此错误:

HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.

Most likely causes:
IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
IIS was not able to process configuration for the Web site or application.
The authenticated user does not have permission to use this DLL.
The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

Things you can try:
Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
Check the event logs to see if any additional information was logged.
Verify the permissions for the DLL.
Install the .NET Extensibility feature if the request is mapped to a managed handler.
Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.

Detailed Error Information:
Module     AspNetCoreModuleV2
Notification       ExecuteRequestHandler
Handler    aspNetCore
Error Code     0x00000000
Requested URL      https://sitename:80/
Physical Path      C:\home\site\wwwroot
Logon Method       Anonymous
Logon User     Anonymous

More Information:
This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.
View more information »

Microsoft Knowledge Base Articles:

I am trying to publish my .net core web app in Azure, I have managed to publish my project using github actions.
Also I have created an Azure sql database (I configured my asp .net core application with azure sql database using appsettings, but also i added the connection string in the configurations of web app in Azure).

web.config content

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

In azure service logs I get this error:

HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.

Most likely causes:
IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
IIS was not able to process configuration for the Web site or application.
The authenticated user does not have permission to use this DLL.
The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

Things you can try:
Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
Check the event logs to see if any additional information was logged.
Verify the permissions for the DLL.
Install the .NET Extensibility feature if the request is mapped to a managed handler.
Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.

Detailed Error Information:
Module     AspNetCoreModuleV2
Notification       ExecuteRequestHandler
Handler    aspNetCore
Error Code     0x00000000
Requested URL      https://sitename:80/
Physical Path      C:\home\site\wwwroot
Logon Method       Anonymous
Logon User     Anonymous

More Information:
This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.
View more information »

Microsoft Knowledge Base Articles:

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

与他有关 2025-01-29 02:46:10

问题是:

Azure控制面板中

appService-&gt;设置 - &GT;配置

连接字符串中
那解决了我的错误!

The issue was:

in Azure control panel

Appservice -> Settings -> Configuration

in Connection strings section I added the same key and value pair like on my appsettings and
that solved my error!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文