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:
(source: usf.edu)
Solution - Copy reference to local
Just adding to the existing answers as even I ran into the same error and could not find the the reference in assemblies. I will just share what helped me:
Open package Manager from Tools->NuGet Package Manager->Package Manager Console and type:
After this System.Web.Helpers will appear under References->Assemblies. From there the 'Copy local' property can be changed to True.
Sounds as though MVC has not been installed on the server.
I am running VS 2015Preview and could resolve the issue by installing the latest version of MVC via NuGet.
Just in case anyone is still coming across this one.
I added "Microsoft ASP.NET Razor" using Manage NuGet Packages.
With Add References, for some reason, I only had System.Web.Helpers 1.0.0 and 2.0.0... but not 3.0.0.