简体   繁体   English

如何降级到.NET Core 1.0?

[英]How to Downgrade to .NET Core 1.0?

I am a beginner in .NET Core. 我是.NET Core的初学者。 I am learning Lynda's "Learn ASP.NET Core MVC The Basics" course. 我正在学习Lynda的“学习ASP.NET核心MVC基础知识”课程。 When I try to learn example code of Chapter 1, Video 5, this error appears: 当我尝试学习第1章,视频5的示例代码时,会出现以下错误:

HTTP Error 502.5 - Process Failure

Common causes of this issue:
The application process failed to start
The application process started but then stopped
The application process started but failed to listen on the configured port

Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect

For more information visit: https://go.microsoft.com/fwlink/?LinkID=808681

After going through several questions on Stack Overflow, I find that it is caused due to the inclusion of older .NET Core Version (1.0) in the exercise files. 在浏览Stack Overflow上的几个问题后,我发现它是由于在练习文件中包含较旧的.NET Core Version(1.0)而引起的。 But the Visual Studio in my computer has Version 2.1.4. 但是我的计算机中的Visual Studio有2.1.4版。 The folder "wwwroot" in the exercise might also cause the issue. 练习中的文件夹“wwwroot”也可能导致问题。

It seems that the only way I can fix this issue is by downgrading to Version 1.0. 似乎我可以解决这个问题的唯一方法是降级到1.0版。 But how can I do it? 但是我怎么能这样做呢? Do I have to uninstall Visual Studio Code and install it with .NET Core V 1.0? 我是否必须卸载Visual Studio Code并使用.NET Core V 1.0进行安装?

"Downgrade" is not a feature that is supported in Visual Studio. “降级”不是Visual Studio支持的功能。

Option 1 选项1

Find a tutorial that uses .NET Core 2.0. 查找使用.NET Core 2.0的教程。 Microsoft has really good tutorials and documentation, depending on what you want to cover. Microsoft有非常好的教程和文档,具体取决于您想要涵盖的内容。

.NET Core 1.0 was basically a beta that Microsoft called 1.0 . .NET Core 1.0基本上是微软称为1.0测试版 You gain nothing by learning .NET Core 1.0 at this point due to its limited amount of functionality (and usefulness) compared to .NET Core 2.0. 由于与.NET Core 2.0相比,它的功能(和实用性)有限,因此在此时学习.NET Core 1.0并没有获得任何好处。

.NET Core 2.1 is soon to be released as well. .NET Core 2.1即将发布。

Option 2 选项2

Create a new project that targets .NET Core 1.0 in Visual Studio 2017 and put all of your .NET Core 1.0 code there. 在Visual Studio 2017中创建一个面向.NET Core 1.0的新项目,并将所有.NET Core 1.0代码放在那里。

  1. Choose ASP.NET Core Web Application and name the project. 选择ASP.NET Core Web Application并命名该项目。 Click OK. 单击确定。

在此输入图像描述

  1. On the next screen, change the project to target .NET Core 1.0 from the dropdown. 在下一个屏幕上,将项目从下拉列表更改为目标.NET Core 1.0。 Choose any other options from the tutorial. 从教程中选择任何其他选项。 Click OK. 单击确定。

在此输入图像描述

Option 3 选项3

Retarget your .NET Core 2.0 project to .NET Core 1.0. 将.NET Core 2.0项目重新定位到.NET Core 1.0。

  1. From Solution Explorer, right click the project and choose Edit <projectName>.csproj . 在Solution Explorer中,右键单击该项目,然后选择Edit <projectName>.csproj

在此输入图像描述

  1. Change the TargetFramework element from netcoreapp2.0 to netcoreapp1.0 . TargetFramework元素从netcoreapp2.0更改为netcoreapp1.0

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp1.0</TargetFramework>
  </PropertyGroup>

  ...

</Project>
  1. Fix any compile issues that making this change will likely create. 修复任何可能产生此更改的编译问题。 Every project will have different issues depending on what is referenced by the project. 每个项目都会有不同的问题,具体取决于项目引用的内容。 There is no guide for this, you need to do research to find out what the problems are and fix them yourself. 没有这方面的指南,您需要进行研究以找出问题所在并自行解决。 Google is your friend. 谷歌是你的朋友。

NOTE: None of this will likely fix the underlying cause to your error message, which is a completely different Stack Overflow question than what you are asking here. 注意:这些都不会解决您的错误消息的根本原因,这是一个完全不同的Stack Overflow问题,而不是您在这里提出的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM