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

  • 相关阅读:
    学习笔录——大话设计模式——简单工厂模式
    学习笔录——大话设计模式——代理模式
    学习笔录——大话设计模式——装饰模式
    经典扫雷下载
    C# 实现敏感词过滤
    C# 时间戳的相关操作
    easyui-datetimebox 控件绑定双击事件实现自动选中当前日期时间
    OpenGL笔记(4)纹理
    LearnOpenGL笔记(3)着色器
    c# 值类型和引用类型 笔记
  • 原文地址:https://www.cnblogs.com/vevi/p/5477707.html
Copyright © 2011-2022 走看看