未能加载文件或程序集"Microsoft.Web.Infrastructure 的解决方案

本文提供了一种解决在部署MVC5项目时遇到的“未能加载文件或程序集Microsoft.Web.Infrastructure”的错误的方法。通过使用VisualStudio的NuGet包管理器安装Microsoft.Web.Infrastructure包,可以有效解决该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在部署MVC5项目时报“未能加载文件或程序集"Microsoft.Web.Infrastructure ””的错误提示,不多说直接看解决方案;

 

解决方案:

   

VisualStudio 打开项目  打开工具  ->  NuGet包管理器 -> 程序包管理控制台

看到一个PM>   输入窗口 

在窗口输入  Install-Package Microsoft.Web.Infrastructure    回车显示下图

这样就可以了 重新发布一下就行了

 

转载于:https://www.cnblogs.com/KarlCai/p/6564824.html

Microsoft.AspNetCore.Server.Kestrel[13] Connection id "0HNASLCBQUQ75", Request id "0HNASLCBQUQ75:00000002": An unhandled exception was thrown by the application. System.IO.FileNotFoundException: Could not load file or assembly 'Dapper, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. File name: 'Dapper, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' at NHisApi.Controllers.TestSjkController.AddLis() at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at NHisApi.Controllers.TestSjkController.AddLis() at lambda_method1(Closure , Object , Object[] ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
03-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值