【问题标题】:Constructor on type 'System.Web.Mvc.WebFormView' not found找不到类型“System.Web.Mvc.WebFormView”的构造函数
【发布时间】:2012-05-17 01:18:59
【问题描述】:

我刚刚从 TFS 中检查了一个 asp net mvc 项目。安装所有必需的 NuGet 包后,我尝试运行该项目。

尝试使用 MvcSiteMapProvider 的以下方法之一时,我不断收到此错误消息:

  • 站点地图标题()
  • 站点地图()
  • SiteMapPath()

我正在使用 .NET Framework 4.0、MVC3 和 MvcSiteMapProvider 版本 3.2.2.0。

我通过 NuGet(包管理器控制台)安装了 MvcSiteMapProvider。

我的项目使用运行时版本 v2.0.50727 引用 ...\packages\MvcSiteMapProvider.3.2.2.0\lib\net40\MvcSiteMapProvider.dll 中的 DLL

[MissingMethodException: Constructor on type 'System.Web.Mvc.WebFormView' not found.]
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1136
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111
System.Activator.CreateInstance(Type type, Object[] args) +19
MvcSiteMapProvider.Internal.MvcSiteMapProviderViewEngine.CreatePartialView(ControllerContext controllerContext, String partialPath) +109
System.Web.Mvc.VirtualPathProviderViewEngine.FindPartialView(ControllerContext controllerContext, String partialViewName, Boolean useCache) +217
System.Web.Mvc.<>c__DisplayClass8.<FindPartialView>b__7(IViewEngine e) +21
System.Web.Mvc.ViewEngineCollection.Find(Func`2 lookup, Boolean trackSearchedPaths) +127
System.Web.Mvc.ViewEngineCollection.FindPartialView(ControllerContext controllerContext, String partialViewName) +170
System.Web.Mvc.Html.TemplateHelpers.ExecuteTemplate(HtmlHelper html, ViewDataDictionary viewData, String templateName, DataBoundControlMode mode, GetViewNamesDelegate getViewNames, GetDefaultActionsDelegate getDefaultActions) +418
System.Web.Mvc.Html.TemplateHelpers.TemplateHelper(HtmlHelper html, ModelMetadata metadata, String htmlFieldName, String templateName, DataBoundControlMode mode, Object additionalViewData, ExecuteTemplateDelegate executeTemplate) +1117
System.Web.Mvc.Html.TemplateHelpers.TemplateHelper(HtmlHelper html, ModelMetadata metadata, String htmlFieldName, String templateName, DataBoundControlMode mode, Object additionalViewData) +66
System.Web.Mvc.Html.TemplateHelpers.TemplateFor(HtmlHelper`1 html, Expression`1 expression, String templateName, String htmlFieldName, DataBoundControlMode mode, Object additionalViewData, TemplateHelperDelegate templateHelper) +117
System.Web.Mvc.Html.TemplateHelpers.TemplateFor(HtmlHelper`1 html, Expression`1 expression, String templateName, String htmlFieldName, DataBoundControlMode mode, Object additionalViewData) +100
System.Web.Mvc.Html.DisplayExtensions.DisplayFor(HtmlHelper`1 html, Expression`1 expression, String templateName) +57
MvcSiteMapProvider.Web.Html.SiteMapTitleHelper.SiteMapTitle(MvcSiteMapHtmlHelper helper, String templateName) +412
MvcSiteMapProvider.Web.Html.SiteMapTitleHelper.SiteMapTitle(MvcSiteMapHtmlHelper helper) +33
ASP._Page_Views_Shared__Layout_cshtml.Execute() in xxx\Views\Shared\_Layout.cshtml:28

任何帮助将不胜感激。

【问题讨论】:

  • 您使用的是哪个 .NET 版本?
  • 抱歉,忘记添加到问题中
  • 您是如何获得 MvcSiteMapProvider 的?努吉特?手动构建?
  • 能否检查您的引用,看看您引用的是 net35 还是 net40 文件夹中的 DLL?
  • 这很奇怪,它应该只在旧的 MVC 版本上使用Activator.CreateInstance。可以试试新版本 3.2.3.0 吗?

标签: asp.net-mvc-3 mvcsitemapprovider


【解决方案1】:

尝试更新到版本 3.2.3,然后它应该可以工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-12-12
    • 2013-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-24
    • 1970-01-01
    相关资源
    最近更新 更多