【发布时间】:2017-05-15 15:19:58
【问题描述】:
ASP.NET Core,而非框架
我不久前创建了一个 Web API 项目,作为我们使用的一些项目的本地开发主机。这一直运作良好。我不知道我是否在工作和不工作之间安装了 VS 2017 更新。现在,当我启动它时,它会启动 Web 浏览器,然后立即终止 Web 应用程序(参见输出)。
我决定尝试通过创建一个新项目来重建我的项目,但令我惊讶的是,我在这里也遇到了问题。我已经包含了可以在我的机器上产生问题的输出和步骤。
输出:
code:-32000
message:No script for id: 35
'dotnet.exe' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\1.1.2\System.Private.CoreLib.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[18760] dotnet.exe: Program Trace' has exited with code 0 (0x0).
The program '[18760] dotnet.exe' has exited with code -532462766 (0xe0434352).
The program '[7360] iisexpress.exe: Program Trace' has exited with code 0 (0x0).
The program '[18824] chrome.exe: WebKit' has exited with code -1 (0xffffffff).
The program '[7360] iisexpress.exe' has exited with code 0 (0x0).
重现步骤:
1) Select File | New Project
2) Select Templates > Visual C# > .NET Core > ASP.NET Core Web Application (.NET Core)
3) Click OK
4) Select Web API
5) Verify that "Enable Docker Support" is unchecked and "Authentication" is "No Authentication"
5) Click OK
6) Select Debug | Start Debugging
7) Wait ~20 seconds for the project co crash
我尝试在“Main”方法的左大括号上放置一个断点,但这从未被命中。
使用 dotnet run 的控制台输出:
C:\Projects\WebApplication1>dotnet run
The current project is not valid because of the following errors:
C:\Projects\WebApplication1(1,0): error DOTNET1017: Project file does not exist 'C:\Projects\WebApplication1\project.json'.
C:\Projects\WebApplication1>
我不确定为什么 project.json 是预期的,因为这些文件被取消了,取而代之的是 .csproj 文件。查看应用程序属性,我可以看到目标框架是 .NETCoreApp1.1。为了解决这个问题,我安装了 .NET Core 运行时(x86 和 x64)版本 1.0.5 和 1.1.2,但我想只需要 1.1.2 版本。
我还运行了 dotnet --info 并得到以下输出:
C:\Users\john\Documents\Visual Studio 2017\Projects\WebApplication1>dotnet --info
.NET Command Line Tools (1.0.0-preview2-003121)
Product Information:
Version: 1.0.0-preview2-003121
Commit SHA-1 hash: 1e9d529bc5
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x86
已安装的 SDK 版本(根据程序和功能):
.NET Core SDK 1.0.0 (x64) Installer (x64)
.NET Core SDK 1.0.1 (x64)
.NET Core SDK 1.0.3 (x64)
.NET Core SDK 1.0.4 (x64)
Microsoft .NET Core 1.0.0 - SDK Preview 2 (x86)
Microsoft .NET Core 1.0.0 - SDK Preview 2 (x64)
Microsoft .NET Core 1.0.1 - SDK Preview 1.0.0 Preview 2-003131 (x64)
Microsoft .NET Core 1.0.1 - VS 2015 Tooling Preview 2-003131
Microsoft .NET Core 1.0.5 - Runtime (x64)
Microsoft .NET Core 1.0.5 - Runtime (x86)
Microsoft .NET Core 1.1.2 - Runtime (x64)
Microsoft .NET Core 1.1.2 - Runtime (x86)
其他信息:
- 我正在运行 Windows 10 Enterprise N
- 我的开发环境是 Visual Studio Enterprise 2017 版本 15.2 (26430.6) 版本。
如何让它再次工作?
【问题讨论】:
标签: c# asp.net-core .net-core