使用@HtmlHelper对monodevelop

时间:2015-10-26 15:10:56

标签: c# mono monodevelop

我是monodevelop(linux)中的新手。我正在创建一个MVC 5项目,而将Web.config创建到views文件夹中:

<system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization"/>
        <add namespace="System.Web.Routing" />
      </namespaces>
    </pages>
</system.web.webPages.razor>

然而在我的Index.cshtml @ Html.ActionLink(“NHibernate”,“Index”)或任何组合(如@ Html.ActionLink(“NHibernate”,“Index”,“Home”,new {area =“NH) “},new {@class =”btn btn-primary“}))抛出以下异常:

system.missingMethodException而 找不到方法'RouteCollection.get_AppendTrailingSlash'。

描述:HTTP 500.Error处理请求。 详细信息:非Web异常。异常来源(应用程序或对象的名称):System.Web.Mvc。 异常堆栈跟踪:   在System.Web.Mvc.RouteCollectionExtensions.GetVirtualPathForArea(System.Web.Routing.RouteCollection routes,System.Web.Routing.RequestContext requestContext,System.String name,System.Web.Routing.RouteValueDictionary values,System.Boolean&amp; usingAreas)[ 0x00052] in:0   在System.Web.Mvc.RouteCollectionExtensions.GetVirtualPathForArea(System.Web.Routing.RouteCollection routes,System.Web.Routing.RequestContext requestContext,System.String name,System.Web.Routing.RouteValueDictionary values)[0x00000] in:0   在System.Web.Mvc.UrlHelper.GenerateUrl(System.String routeName,System.String actionName,System.String controllerName,System.Web.Routing.RouteValueDictionary routeValues,System.Web.Routing.RouteCollection routeCollection,System.Web.Routing。 RequestContext requestContext,Boolean includeImplicitMvcValues)[0x00035] in:0   在System.Web.Mvc.UrlHelper.GenerateUrl(System.String routeName,System.String actionName,System.String controllerName,System.String protocol,System.String hostName,System.String fragment,System.Web.Routing.RouteValueDictionary routeValues, System.Web.Routing.RouteCollection routeCollection,System.Web.Routing.RequestContext requestContext,Boolean includeImplicitMvcValues)[0x00000] in:0   在System.Web.Mvc.HtmlHelper.GenerateLinkInternal(System.Web.Routing.RequestContext requestContext,System.Web.Routing.RouteCollection routeCollection,System.String linkText,System.String routeName,System.String actionName,System.String controllerName,System .String协议,System.String hostName,System.String片段,System.Web.Routing.RouteValueDictionary routeValues,IDictionary 2 htmlAttributes, Boolean includeImplicitMvcValues) [0x00000] in <filename unknown>:0 at System.Web.Mvc.HtmlHelper.GenerateLink (System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteCollection routeCollection, System.String linkText, System.String routeName, System.String actionName, System.String controllerName, System.String protocol, System.String hostName, System.String fragment, System.Web.Routing.RouteValueDictionary routeValues, IDictionary 2 htmlAttributes)[0x00000] in:0   在System.Web.Mvc.HtmlHelper.GenerateLink(System.Web.Routing.RequestContext requestContext,System.Web.Routing.RouteCollection routeCollection,System.String linkText,System.String routeName,System.String actionName,System.String controllerName,System .Web.Routing.RouteValueDictionary routeValues,IDictionary 2 htmlAttributes) [0x00000] in <filename unknown>:0 at System.Web.Mvc.Html.LinkExtensions.ActionLink (System.Web.Mvc.HtmlHelper htmlHelper, System.String linkText, System.String actionName, System.String controllerName, System.Web.Routing.RouteValueDictionary routeValues, IDictionary 2 htmlAttributes)[0x00029] in:0   在System.Web.Mvc.Html.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper htmlHelper,System.String linkText,System.String actionName)[0x0000e] in:0   在/home/admin1/Proyectos/TestMVC/TestMVC/Views/Home/Index.cshtml:14中的ASP._Page_Views_Home_Index_cshtml.Execute()[0x0010e]   在System.Web.WebPages.WebPageBase.ExecutePageHierarchy()[0x00054] in:0   在System.Web.Mvc.WebViewPage.ExecutePageHierarchy()[0x0001d] in:0   在System.Web.WebPages.StartPage.RunPage()[0x0000d]中:0   在System.Web.WebPages.StartPage.ExecutePageHierarchy()[0x0001a] in:0   在System.Web.WebPages.WebPageBase.ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext,System.IO.TextWriter writer,System.Web.WebPages.WebPageRenderingBase startPage)[0x00027] in:0   在System.Web.Mvc.RazorView.RenderView(System.Web.Mvc.ViewContext viewContext,System.IO.TextWriter writer,System.Object实例)[0x000c7] in:0   在System.Web.Mvc.BuildManagerCompiledView.Render(System.Web.Mvc.ViewContext viewContext,System.IO.TextWriter writer)[0x00067] in:0   在System.Web.Mvc.ViewResultBase.ExecuteResult(System.Web.Mvc.ControllerContext context)[0x00080] in:0   在System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(System.Web.Mvc.ControllerContext controllerContext,System.Web.Mvc.ActionResult actionResult)[0x00000] in:0   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList 1 filters, Int32 filterIndex, System.Web.Mvc.ResultExecutingContext preContext, System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x0000b] in <filename unknown>:0 at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive (IList 1个过滤器,Int32 filterIndex,System.Web.Mvc.ResultExecutingContext preContext,System.Web.Mvc.ControllerContext controllerContext,System.Web.Mvc.ActionResult actionResult) [0x0004f] in:0

1 个答案:

答案 0 :(得分:0)

Monodevelop中的实际框架版本不支持AppendTrailingSlash属性。现在最好的解决方案是使用estandar html。

相关问题