c# - 如何降级到.NET Core 1.0?

标签 c# asp.net asp.net-core .net-core asp.net-core-mvc

我是 .NET Core 的初学者。我正在学习 Lynda 的“学习 ASP.NET Core MVC 基础知识”类(class)。当我尝试学习第 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

经过Stack Overflow上的几个问题后,我发现这是由于练习文件中包含较旧的.NET Core版本(1.0)引起的。但是我电脑里的 Visual Studio 版本是 2.1.4。练习中的文件夹“wwwroot”也可能导致问题。

似乎我能解决这个问题的唯一方法是降级到 1.0 版。但是我该怎么做呢?我是否必须卸载 Visual Studio Code 并使用 .NET Core V 1.0 安装它?

最佳答案

“降级”不是 Visual Studio 支持的功能。

选项 1

查找使用 .NET Core 2.0 的教程。 Microsoft 有非常好的教程和文档,具体取决于您想要涵盖的内容。

.NET Core 1.0 基本上是微软称为 1.0 的 beta。由于与 .NET Core 2.0 相比功能(和实用性)有限,此时学习 .NET Core 1.0 将一无所获。

.NET Core 2.1 也即将发布。

选项 2

在 Visual Studio 2017 中创建一个以 .NET Core 1.0 为目标的新项目,并将所有 .NET Core 1.0 代码放在那里。

  1. 选择 ASP.NET Core Web 应用程序并为项目命名。点击确定。

enter image description here

  1. 在下一个屏幕上,从下拉列表中将项目更改为以 .NET Core 1.0 为目标。从教程中选择任何其他选项。点击确定。

enter image description here

选项 3

将您的 .NET Core 2.0 项目重新定位到 .NET Core 1.0。

  1. 在解决方案资源管理器中,右键单击项目并选择 Edit <projectName>.csproj .

enter image description here

  1. 更改 TargetFramework来自 netcoreapp2.0 的元素至 netcoreapp1.0 .

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

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

  ...

</Project>
  1. 修复进行此更改可能会产生的任何编译问题。每个项目都会有不同的问题,具体取决于项目引用的内容。没有这方面的指南,您需要进行研究以找出问题所在并自行解决。 Google 是您的 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.

关于c# - 如何降级到.NET Core 1.0?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49349614/

相关文章:

mysql - asp.net sql从多个表中选择数据

asp.net - ASP.NET 5 类库(包)中的 .NET Platform 5.4 是什么?

c# - 在 C# 中生成 HTML 页面 - 最佳实践

c# - 无法获取正在运行/当前进程的列表?

c# - 是否可以从 .net 应用程序禁用 c++ 断言

c# - 为什么自定义配置部分的 StringValidator 总是失败?

asp.net - Cookie 域在 asp.net 4.5 中始终为空

asp.net-core - .NET Core Blazor PCI 合规性

c# - Audit.NET动态获取数据库凭据

c# - 覆盖标签 OnPaint?