C# – Could not load file or assembly ‘System.Web.Helpers, error on IIS 8

asp.netasp.net-mvc-4ciis

I have a MVC4 web application that works fine on Visual Studio 2012, using the local IIS Express Server. When I publish the application to an IIS 8 web server running on Windows 2012, the initial login page displays correctly. However, using remote debugging, I see that when I check the credentials using the following line:

if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))

I get the error shown in the figure below:
System.Web.Helpers error
(source: usf.edu)

Best Answer

Solution - Copy reference to local

  1. Right click on reference System.Web.Helpers and select Properties
  2. Change Copy Local to true.
  3. Build Solution