I have a web app that runs just fine on my local machine. It was an MVC 3 web app that I just recently moved to MVC 5 Now when I deployed it to the remove VPS, I get this error.
System.Web.WebPages.Razor, Version=1.0.0.0 should not be used anywhere. Why am I getting this error?
All config files should be using 3.0.0.0 The target fremework is 4.5. ASP.NET 4.5 installed on the VPS I haven't installed MVC5 on the remote VPS.
Are there any documentation on staps to follow to deploy MVC 5 to remote server?
3960
w3wp.exe
IIS APPPOOL\\Mysite
InvalidOperationException
The pre-application start initialization method Start on type Microsoft.Web.Helpers.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly ' System.Web.WebPages.Razor, Version=1.0.0.0 , Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040). at
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection 1 methods, Func
1 setHostingEnvironmentCultures) at System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) at System.Web.Compilation.BuildManager.ExecutePreAppStart() at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) Could not load file or assembly ' System.Web.WebPages.Razor, Version=1.0.0.0 , Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at Microsoft.Web.Helpers.PreApplicationStartCode.Start()
Add an assembly binding redirect in the web.config:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.