gpt4 book ai didi

iis-10 - HTTP 错误 500.31 - ANCM 无法在 IIS 中找到 native 依赖项

转载 作者:行者123 更新时间:2023-12-02 11:29:44 24 4
gpt4 key购买 nike

我尝试运行 Blazor 应用程序。

Web.Server runs .NET Core 3.0
Web.Client runs .NET Standard 2.0
Web.Shared runs .NET Standard 2.0

将应用程序发布并上传到 IIS 后,我收到此错误:

HTTP Error 500.31 - ANCM Failed to Find Native Dependencies
Common solutions to this issue:
The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.

事件查看器包含此错误消息:

HTTP Error 500.31 - ANCM Failed to Find Native Dependencies

当我运行 dotnet --info 时,我可以看到 Microsoft.NetCore.AppMicrosoft.AspNetCore.App 都包含版本3: PS C:\Users\FooBar> dotnet --info .NET Core SDK(反射(reflect)任何 global.json): 版本:3.0.100-preview6-012264 提交:be3f0c1a03

Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview6-012264\

Host (useful for support):
Version: 3.0.0-preview6-27804-01
Commit: fdf81c6faf

.NET Core SDKs installed:
1.0.4 [C:\Program Files\dotnet\sdk]
2.0.0 [C:\Program Files\dotnet\sdk]
2.1.101 [C:\Program Files\dotnet\sdk]
3.0.100-preview6-012264 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview6.19307.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview6-27804-01 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview6-27804-01 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

ASP.NET Core 诊断:

IMPORTANT: This report might contain confidential information. Mask such before sharing to others.
-----
System Time: 6/18/2019 12:50:58 AM
Processor Architecture: AMD64
OS: Microsoft Windows NT 10.0.17763.0
Server Type: IIS

Scan 31 installed module(s).
ASP.NET Core module version 2 is installed for .NET Core 2.2 and above: C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll (13.0.19158.0).

Scan 86 registered handler(s).
* Found a valid ASP.NET Core handler as { Name: aspNetCore, Path: *, State: Enabled, Module: AspNetCoreModuleV2, Entry Type: Local }.
Visual C++ runtime is detected (expected: 14.0, detected: 14.14.26405.0 built by: VCTOOLSREL): C:\WINDOWS\system32\msvcp140.dll.
Scan aspNetCore section.
"processPath": dotnet.
"arguments": .\Web.Server.dll.
"hostingModel": inprocess.
"runtimeTarget": .NETCoreApp,Version=v3.0.
Please refer to pages such as https://dotnet.microsoft.com/download/dotnet-core/2.2 to verify that ASP.NET Core version 13.0.19158.0 matches the runtime of the web app.

为什么 IIS 在我的服务器上抛出此错误?

注意:它适用于 Visual Studio 2019。

最佳答案

将 ASP.NET Core 项目从 .NET Core 3.0 升级到 3.1 并安装 Microsoft .NET Core 3.1.0 - Windows Server 托管后,我收到了相同的错误。

快速(但不好)修复

将 web.config 处理程序从 AspNetCoreModuleV2 更改为 AspNetCoreModule 并且工作正常。

很好的修复

通过检查事件查看器查找根本原因。导致此错误的原因可能有多种,但就我而言,它没有找到与 CodeAnalysis 相关的程序集

Unable to locate application dependencies. Ensure that the versions ofMicrosoft.NetCore.App and Microsoft.AspNetCore.App targeted by theapplication are installed.

Could not find 'aspnetcorev2_inprocess.dll'. Exception message: Error:An assembly specified in the application dependencies manifest(myproject.deps.json) was not found: package:'Microsoft.CodeAnalysis.CSharp.Workspaces', version: '3.3.1' path:'lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.Workspaces.dll'

虽然它们相关,但这些消息发生在不同的事件中。

关于iis-10 - HTTP 错误 500.31 - ANCM 无法在 IIS 中找到 native 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56630477/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com