无法在mvc 5中加载文件或程序集“System.Web.Mvc”

时间:2016-01-27 06:24:16

标签: c# asp.net .net asp.net-mvc dll

错误:
    无法加载文件或程序集“ System.Web.Mvc 版本= 5.2.3.0 文化=中性 PublicKeyToken = 31bf3856ad364e35 '或其中一个依赖项。系统找不到指定的文件

<compilation>
<assemblies>
<add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral,       PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value     [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. 
Note: There is some performance penalty associated with assembly bind failure   logging.
To turn this feature off, remove the registry value   [HKLM\Software\Microsoft\Fusion!EnableLog].

我的 web.config

<configuration>  
<connectionStrings>
<add name="AbbasMVCContext" connectionString="Data Source=DESKTOP- 584JRQR\ASUSSQLSERVER;Initial Catalog=AbbasMVCDB;Integrated Security=True" providerName="System.Data.SqlClient" />          
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<authentication mode="Forms">
<forms loginUrl="~/Authentication/Login"></forms>
</authentication>  
</system.web>
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.codedom>
<compilers>    
</compilers>
</system.codedom>
</configuration>
主机提供商和bin文件夹中的 bin-address Home / mywebsite.com / wwwroot / bin

roslyn  Rename File/Folder  Edit Permissions        
Abbas MVC.dll  Rename File/Folder  Edit Permissions 
Antlr3.Runtime.dll  Rename File/Folder  Edit Permissions    
BusinessEntities.dll  Rename File/Folder  Edit Permissions  
BusinessLayer.dll  Rename File/Folder  Edit Permissions 
DataAccessLayer.dll  Rename File/Folder  Edit Permissions   
EntityFramework.dll  Rename File/Folder  Edit Permissions
EntityFramework.SqlServer.dll  Rename File/Folder  Edit Permissions          Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll  Rename File/Folder  Edit Permissions.  
Microsoft.Web.Infrastructure.dll  Rename File/Folder  Edit Permissions        Newtonsoft.Json.dll  Rename File/Folder  Edit Permissions
System.Data.DataSetExtensions.dll  Rename File/Folder  Edit Permissions 
System.Net.Http.Formatting.dll  Rename File/Folder  Edit Permissions
System.Web.Extensions.dll  Rename File/Folder  Edit Permissions 
System.Web.Helpers.dll  Rename File/Folder  Edit Permissions             
System.Web.Http.dll  Rename File/Folder  Edit Permissions
System.Web.Http.WebHost.dll  Rename File/Folder  Edit Permissions       
System.Web.Mvc.dll  Rename File/Folder  Edit Permissions           
System.Web.Optimization.dll  Rename File/Folder  Edit Permissions        
System.Web.Razor.dll  Rename File/Folder  Edit Permissions       
System.Web.WebPages.Deployment.dll  Rename File/Folder  Edit Permissions     
System.Web.WebPages.dll  Rename File/Folder  Edit Permissions        
System.Web.WebPages.Razor.dll  Rename File/Folder  Edit Permissions      
ViewModel.dll  Rename File/Folder  Edit Permissions       
WebGrease.dll  Rename File/Folder  Edit Permissions

为什么它不起作用。

1 个答案:

答案 0 :(得分:0)

这必须是默认控制器和操作名称的名称才能更改我们的值 在App_start-&gt; RouteConfig.cs

routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Controller name", action = "Action name", id =      UrlParameter.Optional }
);