无法使用命令行"dotnet .\myapi.dll"启动进程,错误代码 = '0x80004005 : 80008096



我在这里问了一个关于如何确保构建中包含正确版本的dotnet的问题。

我想知道这个版本是否还没有部署。我将在部署的文件中查找哪些内容?

部署确实包括以下文件

52816 dotnet-aspnet-codegenerator-design.dll689584 Microsoft.CodeAnalysis.CSharp.Workspaces.dll2624944 Microsoft.CodeAnalysis.Workspaces.dll23632 Microsoft.VisualStudio.Web.CodeGeneration.Contracts.dll73296 Microsoft.VisualStudio.Web.CodeGeneration.Core.dll35408 Microsoft.VisualStudio.Web.CodeGeneration.dll69200 Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.dll28752 Microsoft.VisualStudio.Web.CodeGeneration.Template.dll34896 Microsoft.VisualStudio.Web.CodeGeneration.Utils.dll157776 Microsoft.VisualStudio.Web.CodeGenerators.Mvc.dll

当我登录到机器时,代码部署在上面并键入

dotnet .myapi.dll  

错误是

It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '2.1.5' was not found.
- Check application dependencies and target a framework version installed at:
C:Program Filesdotnet
- Installing .NET Core prerequisites might help resolve this problem:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
- The .NET Core framework and SDK can be installed from:
https://aka.ms/dotnet-download

浏览到网站url会产生

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

事件日志显示

failed to start process with commandline 'dotnet .myapi.dll', ErrorCode = '0x80004005 : 80008096.

如何确保部署了dotnet?

[更新]

我看到c:\program files\dotnet.exe的版本是2.1.26919.1

但是,我已经安装了.Net Core Runtime 2.1.5(x64(我可以判断它已经安装,因为当我重新运行安装程序时,它会询问我是要修复还是卸载。

我想既然api是在IIS下运行的,它就不需要dotnet.exe了?

计算机正在运行Windows 2012 Server R2

只是发布这篇文章,以防对某人有所帮助。我在IIS上使用ASP.Net Core部署常规.Net站点时遇到了这个错误。在我的案例中,安装了.Net,但我的网站出现了500内部服务器错误,在事件日志中,我显示"无法使用命令行"dotnet.\myapi.dll"启动进程"。它最终成为了我的web.config文件,Visual Studio的行起始为:

<aspNetCore processPath="dotnet" arguments=".myapi.dll"

这最终成为了一个问题,这就是你启动.Net Core网站的方式。但我的目标是普通的.Net。所以我的web.config需要是:

<aspNetCore processPath=".myapi.exe" arguments=".myapi.dll"

在发现这一点之前,我曾尝试安装.Net Core运行时和SDK,这两个版本最终都将错误变形为500.19内部服务器错误,错误代码为0x8007000d。这表明我的web.config或AppHost(IIS(中存在格式错误的XML。这两个文件都没有XML语法问题。此特定错误是由于删除了.Net Core托管捆绑包而导致的。您需要为服务器安装托管捆绑包,才能识别"aspNetCore"标记。一旦安装了托管捆绑包并对web.config进行了更改,我就开始运行了。

希望这能帮助到别人。这是我开始调试时得到的第一个搜索结果。

当我运行时

dotnet运行。\myapi.dll

我有

Did you mean to run dotnet SDK commands?
Please install dotnet SDK from: go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409

当我转到URL时,它安装了SDK 2.1.403

这起到了作用。

我不得不"修理"。Net Core 2.1 Windows Server主机以消除此错误。

相关内容

最新更新