简体   繁体   English

dotnet core 2.1 app的“HTTP错误502.5 - 进程失败”

[英]“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核心的一个小例子

  • Project level configuration (such as .net core or c# version) can be set from the .csproj file 可以从.csproj文件设置项目级别配置(例如.net核心或c#版本)
  • Web launch related configurations (such as linking your IConfiguration to a custom source) can be set up from the program.cs 可以从program.cs设置与Web启动相关的配置(例如将IConfiguration链接到自定义源)
  • The middleware and application related configurations (such as mapping your db connection string) can be set up from the startup cs class 可以从startup cs类设置中间件和应用程序相关的配置(例如映射数据库连接字符串)

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.

相关问题 .NET Core 2.1.5 HTTP错误502.5-部署过程中失败 - .NET Core 2.1.5 HTTP Error 502.5 - Process Failure on Deploy ASP.NET CORE 3.0 - HTTP 错误 502.5 - 进程失败 - ASP.NET CORE 3.0 - HTTP Error 502.5 - Process Failure 使用 ASP.NET Core 2.1 WebAPI 在 Azure PaaS 中访问 Azure Key Vault 时出现“HTTP 错误 502.5 - 进程失败” - "HTTP Error 502.5 - Process Failure" accessing Azure Key Vault in Azure PaaS with ASP.NET Core 2.1 WebAPI aspnet-core-ad-authentication 项目 HTTP 错误 502.5 - 进程失败 - aspnet-core-ad-authentication project HTTP Error 502.5 - Process Failure ASP.NET Core 1.1 HTTP错误502.5-启动时进程失败 - ASP.NET core 1.1 HTTP Error 502.5 - Process Failure on startup HTTP 错误 502.5 - 升级到 ASP.NET Core 2.2 后 ANCM 进程外启动失败 - HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure after upgrading to ASP.NET Core 2.2 错误502.5-进程失败ASP.NET Core 1.1 - Error 502.5 - Process Failure ASP.NET Core 1.1 运行.NET Core API项目会出现错误502.5-进程失败 - Running .NET Core API project gives Error 502.5 - Process Failure HTTP错误502.5 - 尝试运行项目时出现进程失败 - HTTP Error 502.5 - Process Failure when trying to run my project ASP.NET Core 2.1 IIS托管错误502.5-无法执行dotnet命令来确定原因 - ASP.NET Core 2.1 IIS hosting error 502.5 - Unable to execute dotnet command to determine cause
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM