Mvc 5.1 MissingMethodException System.Web.WebPages.TypeHelper.ObjectToDictionaryUncached
Asked Answered
A

5

6

I'm update my MVC5 project to MVC5.1 and now have exception on route dictionary:

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

stack trace:

{"Method not found: 'System.Web.Routing.RouteValueDictionary System.Web.WebPages.TypeHelper.ObjectToDictionaryUncached(System.Object)'."}

at System.Web.Mvc.RouteCollectionExtensions.CreateRouteValueDictionaryUncached(Object values)
at System.Web.Mvc.RouteCollectionExtensions.IgnoreRoute(RouteCollection routes, String url, Object constraints)
at System.Web.Mvc.RouteCollectionExtensions.IgnoreRoute(RouteCollection routes, String url)
at WebApplication1.RouteConfig.RegisterRoutes(RouteCollection routes) in c:\Users\aivanov\Documents\Visual Studio 2013\Projects\WebApplication1\WebApplication1\App_Start\RouteConfig.cs:line 14
at WebApplication1.MvcApplication.Application_Start() in c:\Users\aivanov\Documents\Visual Studio 2013\Projects\WebApplication1\WebApplication1\Global.asax.cs:line 17
Antiquarian answered 27/1, 2014 at 8:41 Comment(0)
C
17

In the References i found that System.Web.WebPages.dll version 3.0.11001.0 shows this type of error, but when i replace it with System.Web.WebPages.dll version 3.0.20129.0 it works. So Simply you should delete the old one from refrences and download the other version and than clean solution, rebuild and it will work.

Cantu answered 14/3, 2014 at 9:7 Comment(4)
Where do you download that version?Cark
I only needed to do Clean Solution and problem solved itself.Fog
When you use nuget.exe from console "Microsoft.AspNet.Mvc -Version 5.1.1" will download System.Web.WebPages.dll as well.Emilio
cansomeone please tell me as to how to download a different version of that dll once removed.Hubie
S
1

In my case helped deleting files in temporary folder "C:\Users{yourprofilename}\AppData\Local\Temp\Temporary ASP.NET Files\"

Swung answered 8/4, 2014 at 19:14 Comment(0)
P
0

Please make sure you have a reference to : using System.Web.Http; (c)
or Imports System.Web.Http (vb)

At the top of your RouteConfig File in App_Start directory.

Other than that, although the title is a bit off topic, you might find what your looking for at this link on MS: http://www.asp.net/mvc/tutorials/older-versions/controllers-and-routing/asp-net-mvc-routing-overview-cs - Hopefully this will get you going in the right direction! If you have other details, please let me know and I would be more than happy to continue to try and help!

Hope all is well.

Praiseworthy answered 29/1, 2014 at 6:27 Comment(0)
A
0

In addition to the step suggested by @Leonardo, I also had to add the following to my Web.config:

<compilation debug="true" targetFramework="4.5.1">
    <assemblies>
        <add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"></add>
    </assemblies>
</compilation>
Argilliferous answered 25/7, 2014 at 14:3 Comment(0)
S
0

I reinstalled the nuget packages for Microsoft Asp.Net MVC and it worked for me. I am not sure but I think this problem occurs after upgrading MVC version. So reinstalling nuget package worked.

Spec answered 10/11, 2014 at 5:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.