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

  • 相关阅读:
    zabbix自动发现 url 以及对http返回状态码监控实现 告警
    iOS 开发者账号到期续费流程
    iOS 开发 -----公司测试打包上传流程
    go语言 二叉树
    GO 语言队列实现
    GO 语言常用排序
    go 语言实现栈原理
    循环链表实现原理及运用约瑟夫环实例
    双向链表实现原理
    单向链表实现原理
  • 原文地址:https://www.cnblogs.com/vevi/p/5477707.html
Copyright © 2011-2022 走看看