且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASP.NET Core托管-500个内部服务器错误

更新时间:2022-06-13 09:08:07

我还在web.config中启用了stdoutLog,但是我也没有看到该文件夹​​:

I have also enabled stdoutLog in web.config as but I don't see that folder either:

stdoutLogEnabled ="true"; stdoutLogFile =.\ logs \ stdout"

stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout"

这里有一个窍门-您必须手动创建文件夹logsstdout-然后只有IIS才会在logs文件夹内创建日志文件(并非您所期望的stdout)-不要不要问我为什么,因为我不知道为什么;)

There is one trick here - you must create both folders logs and stdout manually - then and only then IIS will create log file inside logs folder (not stdout as you could expect) - don't ask me why, because I don't know why ;)

糟糕. 500 Internal Server Error启动应用程序时发生错误.

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

通常,这表示Startup.cs中的配置存在问题-最常见的问题包括DB本身问题,迁移问题(如果使用Code First方法),appsettings.js问题,社交登录问题凭据(例如缺少SecretKey)...

Usually, means problems with a configuration in Startup.cs - the most common problems include an issue with DB itself, an issue with migrations (if you are using Code First approach), problems with appsettings.js, problems with Social Logins credentials (like missing SecretKey)...

请参考.\logs\stdout中的日志文件-这是查找有关该问题的详细信息的最快方法:)

Please refer to log file in .\logs\stdout - this is the quickest way to find details about the problem :)

app.UseDeveloperExceptionPage();

app.UseDeveloperExceptionPage();

app.UseDatabaseErrorPage();

app.UseDatabaseErrorPage();

这些将在WebApp完全启动后起作用,但在启动应用程序时不会起作用.

Those will work after your WebApp fully started, but not while starting the application.