【发布时间】:2020-03-09 18:23:12
【问题描述】:
我已经设置了一个 Ubuntu 18.04 Linux 服务器,并使用本地 Kestrel 和 Nginx 作为反向代理在其上运行我的 ASP.NET Core 2.1 应用程序。
当我使用dotnet run 运行应用程序时,它可以正常启动并且我可以访问该网站,但是如果我尝试根据this MS documentation 创建服务,服务器会正常启动(相同的 DLL、数据库、等),并且在尝试访问网页时似乎遇到了一些异常。
ov 14 07:43:05: Executed action method AcademiWeb.Controllers.HomeController.Index (AcademiWeb), returned result Microsoft.AspNetCore.Mvc.ViewResult in 0.4463ms.
Nov 14 07:43:05: #033[40m#033[32minfo#033[39m#033[22m#033[49m: Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor[1]
Nov 14 07:43:05: Executing ViewResult, running view Index.
Nov 14 07:43:06: #033[40m#033[32minfo#033[39m#033[22m#033[49m: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
Nov 14 07:43:06 : Executed action AcademiWeb.Controllers.HomeController.Index (AcademiWeb) in 151.9161ms
Nov 14 07:43:06: #033[41m#033[30mfail#033[39m#033[22m#033[49m: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
Nov 14 07:43:06 ]: An unhandled exception has occurred while executing the request.
Nov 14 07:43:06 : System.ArgumentNullException: Value cannot be null.
Nov 14 07:43:06 : Parameter name: connectionString
Nov 14 07:43:06: at Microsoft.EntityFrameworkCore.Utilities.Check.NotEmpty(String value, String parameterName)
这里有什么我可能遗漏的吗? appsettings 文件有什么问题吗?在线搜索没有得到任何相关结果。
【问题讨论】:
-
有什么例外?请说清楚。 Kestrel 有它的日志记录,所以启用它并读取它的日志文件。
-
我添加了异常,当它检查 connectionString 时它似乎为空 - 可能是访问 appsettings.json 的问题,但我不知道为什么会出现这个问题
标签: linux asp.net-core kestrel