0

I have deployed an application on two different servers.I have taken build using Visual studio 2012.Both servers are using IIS (version 7.5).The operating system used is Windows 2008 R2.The application pool .net framework is 4 .But the build deployed in one server working fine.But the build in other server showing error in web.config itself.The error is regarding the version of assembly referenced.For example:

Assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Anyone, please help me to find out why this error is showing on one server only and why it is working fine on another server.

Kesiya Abraham
  • 753
  • 3
  • 10
  • 24

1 Answers1

1

It's because your two servers don't have the same version of ASP.NET MVC installed (given the version used, I assume you created an asp.net MVC4 project in VS2012, that ASP.NET MVC4 is installed on the first server, and MVC3 only on the second.

  • Either install MVC4 on the second server (standalone installation from https://learn.microsoft.com/en-us/aspnet/mvc/mvc4)
  • Either deploy the necessary aspnet dll aside with your dlls, by setting copyLocal to true (see here: MVC4 minimum references)
  • Or, better, add an nuget referene to Microsoft.AspNet.Mvc in your project (Install-Package Microsoft.AspNet.Mvc -Version 4.0.40804), so deployment include all necessaries dll automatically

Also, you might need some binding redirection in your web.config, but I don't think it's the case here

Treziac
  • 3,056
  • 1
  • 17
  • 19
  • Thanks, Treziac.I have checked both servers.On one server both MVC 3 and MVC 4 are installed, but on the other server, only MVC 3 is installed.That server is a production server.So what will be the best solution to fix this problem? – Kesiya Abraham Aug 25 '17 at 04:17
  • I gave solution - the easiest would be to install mvc4 via the link I have you on the second server (pick standalone install) – Treziac Aug 25 '17 at 05:36
  • One more query, On the first server .net framework 4.7 is installed and on the other server, .net framework 4.5 is installed.Is this factor affect the deployment of the application?As I already said, the second server is a production server and many other applications are running. will those applications affect, If I install MVC 4? – Kesiya Abraham Aug 25 '17 at 08:26
  • As a general rule, always have coherent evnrionment between server, if you don't want some trouble (like now) Installing mvc4 should not arrise issues, but I'm not 100% confident. You can try one of the other two options – Treziac Aug 25 '17 at 11:21
  • I already tried the other two options.But it made some errors again.Hope installing MVC4 will solve the issue.Anyway, thank you for the comments.It helped me to figure out the root cause of the error – Kesiya Abraham Aug 25 '17 at 11:38