zoukankan      html  css  js  c++  java
  • Abp框架下 Area中新建Layout报错的问题

    ABP框架下,新建Admin的Area。

    在Area中定义底层Layout报错,原因为@ApplicationPath无法解析:

    <script type="text/javascript">
            //This is used to get the application's root path from javascript. It's useful if you're running application in a virtual directory under IIS.
            var abp = abp || {}; abp.appPath =  '@ApplicationPath';
        </script>
    

      解决方法:

    修改Admin下的WebConfig文件为:

    <?xml version="1.0"?>
    
    <configuration>
      <configSections>
        <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
          <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
        </sectionGroup>
      </configSections>
    
      <system.web.webPages.razor>
        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <pages pageBaseType="WebMonitor.Web.Views.WebMonitorWebViewPageBase">
          <namespaces>
            <add namespace="System.Web.Mvc" />
            <add namespace="System.Web.Mvc.Ajax" />
            <add namespace="System.Web.Mvc.Html" />
            <add namespace="System.Web.Routing" />
            <add namespace="WebMonitor.Web" />
          </namespaces>
        </pages>
      </system.web.webPages.razor>
    
      <appSettings>
        <add key="webpages:Enabled" value="false" />
      </appSettings>
    
      <system.webServer>
        <handlers>
          <remove name="BlockViewHandler"/>
          <!--<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />-->
        </handlers>
      </system.webServer>
    </configuration>
    

      主要是为了设置pageBaseType属性为:WebMonitor.Web.Views.WebMonitorWebViewPageBase,

    View继承了此类后即可解析:@ApplicationPath

  • 相关阅读:
    JS的(new Date()).toLocaleString,系统设置为24小时,仍然显示为12小时。
    js中获取时间new date()的用法
    Warning: require(): open_basedir restriction in effect. 宝塔错误
    未定义数组下标: 0
    layui 弹层组件文档
    TP5模版中的运算符
    tp5倒计时还有几天几时几分
    【原创】tp5软件过期提醒
    a标签的title属性 换行
    电子签章盖章之jQuery插件jquery.zsign
  • 原文地址:https://www.cnblogs.com/vevi/p/5477707.html
Copyright © 2011-2022 走看看