[英]“HTTP Error 502.5 - Process Failure” for dotnet core 2.1 app
From error log:- Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. 从错误日志: - 未处理的异常:System.IO.FileNotFoundException:无法加载文件或程序集'System.Runtime,Version = 4.2.1.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一。 The system cannot find the file specified.
该系统找不到指定的文件。
As I understand, I need to make changes in app.config to match the versions, but I cannot find app.config. 据我了解,我需要在app.config中进行更改以匹配版本,但我找不到app.config。
My web.config (Posting the entire file incase any error is found) 我的web.config(发布整个文件,发现任何错误)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<modules>
<!-- Remove WebDAV module so that we can make DELETE requests -->
<remove name="WebDAVModule" />
</modules>
<handlers>
<!-- Remove WebDAV module so that we can make DELETE requests -->
<remove name="WebDAV" />
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<!-- When deploying on Azure, make sure that "dotnet" is installed and the path to it is registered in the PATH environment variable or specify the full path to it -->
<aspNetCore requestTimeout="23:00:00" processPath="D:\******ini_nc\Presentation\Nop.Web\bin\Release\netcoreapp2.1\Nop.Core.dll" arguments="dotnet" forwardWindowsAuthToken="false" stdoutLogEnabled="True" stdoutLogFile=".\logs\stdout" startupTimeLimit="3600">
<environmentVariables />
</aspNetCore>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
<directoryBrowse enabled="true" />
</system.webServer>
<system.web>
<identity impersonate="true" />
</system.web>
</configuration>
I would not recommend making changes on files such as web.config that are auto-generated on publishing. 我不建议对发布时自动生成的web.config等文件进行更改。 Here is a small example of how the web.config of .net framework is replaced in .net core
以下是.net框架的web.config如何替换.net核心的一个小例子
IConfiguration
to a custom source) can be set up from the program.cs IConfiguration
链接到自定义源) In your case, check if your server has the required runtime. 在您的情况下,检查您的服务器是否具有所需的运行时。 If possible install the required .net core runtime from dot.net/core in the server.
如果可能,在服务器中从dot.net/core安装所需的.net核心运行时。 If you can't install this due to permissions or something, you can either downgrade your app version or use a self-contained publish.
如果由于权限或其他原因而无法安装,则可以降级应用版本或使用自包含发布。
Downgrading app version 降级应用版本
Keep in mind this means you would lose version specific code. 请记住,这意味着您将丢失特定于版本的代码。 This isn't recommended if you already have a lot of code that might be version specific.
如果您已经拥有许多可能特定于版本的代码,则不建议这样做。 This can be done by updating your .csprog file.
这可以通过更新.csprog文件来完成。 Unlike .net framework.
与.net框架不同。 It is considered clean and safe to update this file in .net core.
在.net核心中更新此文件被认为是干净和安全的。
** self-contained publish** **独立发布**
This option designed to work on systems without any .net core installed. 此选项旨在用于未安装任何.net核心的系统。 It works by creating published files that contain all .net core runtime related files into a huge publish folder.
它的工作原理是创建包含所有.net核心运行时相关文件的已发布文件到一个巨大的发布文件夹中 So, keep in mind the publish folder would be huge.
所以,请记住,发布文件夹将是巨大的。 Have a look at this for more info https://docs.microsoft.com/en-us/dotnet/core/deploying/
有关详细信息, 请查看此信息https://docs.microsoft.com/en-us/dotnet/core/deploying/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.