.net framework 4.0 mvc 应用部署 System.Web.Mvc 错误 Could not load file or assembly 'System.Web.Mvc

在Windows Server 2003上部署基于.NET Framework 4.0的MVC应用时,需先安装.NET Framework 4.0和Windows图像组件(WIC)。出现'Could not load file or assembly 'System.Web.Mvc'错误通常是因为缺少特定版本的System.Web.Mvc.dll。解决方法包括将dll放入项目bin目录,或将引用更改为项目内dll并设置“复制本地”属性为TRUE。

   

    自从VS2010发布之后使用它来做开发的程序员越来越多,其中很多人使用了MVC来作为新的开发框架,但是在系统部署的时候我们也遇到诸多问题,因为目前大多数windows服务器采用的还是Windows Server 2003,所以我们就需要在服务器上安装.net framework 3.5 或4.0 之类的高版本来保证我们的系统运行。

    接下来我们就来部署基于 .net framework 4.0 mvc 的应用系统,首先在服务器上安装.net framework 4.0,但是安装的时候常常遇到一个错误提示,那就是让我们安装microsoft 的Windows 图像组件(WIC),这个很简单,我们只要到microsoft的官方网站下载即可,安装好WIC后继续安装.net framework 4.0就ok了。

    部署系统,很.net framework 2.0的应用部署一样,只是在最后选择asp.net版本的时候选择.net framework 4.0即可。

    访问网站地址,常常会遇到一个错误,Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, ...."

    分析了下,原因是'System.Web.Mvc 2.0版是随VS2010发布,一般并位于C:/Program Files/Microsoft ASP.NET/ASP.NET MVC 2/Assemblies/System.Web.Mvc.dll ,所以我们使用的时候要在引用上做些处理工作。

     最方便的就是把System.Web.Mv.dll

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
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值