Mvc 5.1 MissingMethodException System.Web.WebPages.TypeHelper.ObjectToDictionaryUncached

こ雲淡風輕ζ 提交于 2019-11-28 11:27:45

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.

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

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.

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>

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!