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

  • 相关阅读:
    吴恩达机器学习课程笔记章节二单变量线性回归
    cs224n第六讲依存分析
    吴恩达机器学习课程笔记章节一绪论
    cs224n第二讲词向量表示:word2vec
    cs224n第一讲深度自然语言处理
    DIY的.net正则表达式工具
    不写一行代码,利用常用工具和软件批量下载URL资源
    WEB页面采集器编写经验之一:静态页面采集器
    大规模IP地址黑名单高性能查询实现
    安卓开发入门与面试题01(潭州安卓开发入门教程)
  • 原文地址:https://www.cnblogs.com/vevi/p/5477707.html
Copyright © 2011-2022 走看看