我刚接触asp.net core应用程序。
我有一个使用存储库模式的asp.net core应用程序。它有一个名为ApplicationsAPIController的api控制器。
ApplicationsAPIController有一个GetApplications方法,返回所有应用程序。
我将应用程序发布到远程服务器。在从postman调用GetApplications api时,会抛出500内部服务器错误,响应是以下HTML:
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request. </h2>
<h3>Development Mode</h3>
<p>
Swapping to
<strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the
<strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to
<strong>Development</strong>, and restarting the application.
</p>
注意:上述API在开发环境(本地)中完美运行。
根据错误提示,我认为我需要设置一个暂存或生产环境。但我找不到任何好的、逐步说明的文件来进行设置。我已经尝试了很多方法,但都失败了。