部署在 iis 上的 asp.net core 应用程序遇到 500 内部服务器错误 [英] asp.net core app deployed on iis meets 500 internal server error

查看:40
本文介绍了部署在 iis 上的 asp.net core 应用程序遇到 500 内部服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

:( 哎呀.500内部服务器错误启动应用程序时出错.

:( Oops. 500 Internal Server Error An error occurred while starting the application.

当我将数据库功能添加到我的 asp.net 核心应用程序并将其部署到 iis 时,出现此消息.当我在 Visual Studio 中开发它时,一切都很顺利.但是部署后,出现了这个错误信息.

This message came out when I added database functionality to my asp.net core app and deployed it to iis. When I developed it in Visual Studio, everything went well. But after deploying, this error messages appeared.

我尝试使用 dotnet myapp.dll 在部署文件夹中运行我的应用程序,并发现它运行良好.问题很可能与iis有关.我试图将 <compilation debug="true">..</compilation> 添加到 web.config,但似乎没用.究竟是什么问题,或者有没有其他方法可以查看详细的错误信息以帮助找出发生了什么?

I tried to use dotnet myapp.dll to run my app in the deploy folder, and found out it worked well. It is likely that the problem is relation to iis. I tried to add <compilation debug="true">..</compilation> to web.config, but it seems useless. What is problem are actually, or is there any other way to see the detailed error info to help find out what's happened?

推荐答案

  1. 将 stdoutLogEnabled="false" 更改为 true,然后检查 stdoutLogFile=".logsstdout" 中的日志.那里的错误可能会告诉你一些事情.

  1. Change stdoutLogEnabled="false" to true and then check the logs at stdoutLogFile=".logsstdout". The error(s) there might tell you something.

检查您是否使用 ASPNETCORE_ENVIRONMENT 环境变量,因此使用正确的设置,如连接字符串.默认情况下,您的机器上有开发"环境.

Check that you set up right Environment Name using ASPNETCORE_ENVIRONMENT environment variable as so use correct settings like connection string. On your machine by default you have "Development" environment.

您可以将错误处理中间件用于显示像

app.UseDeveloperExceptionPage();

这篇关于部署在 iis 上的 asp.net core 应用程序遇到 500 内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆