【问题标题】:Asp.net MVC5, how to load .hbs fileAsp.net MVC5,如何加载 .hbs 文件
【发布时间】:2023-04-04 19:49:01
【问题描述】:

我正在尝试在 ASP.net MVC5 项目中使用(车把).hbs 模板,但我无法加载 .hbs 文件。

发生 HTTP 错误 404.3 - 未找到

我是这样加载的,

define [
    'hbs!./index'
],

我确认路径没问题。 (http://local_host:1460/Scripts/js/apps/index/index.hbs)

我需要在某处设置 .hbs 扩展名吗?

谁知道,请指教。

【问题讨论】:

    标签: asp.net-mvc handlebars.js


    【解决方案1】:

    是的,你需要告诉 IIS Express 如何处理.hbs。只需将以下内容添加到项目的 web.config 中:

    <system.webServer>
      ...
      <staticContent>
        <mimeMap fileExtension=".hbs" mimeType="text/x-handlebars-template" />
      </staticContent>
    </system.webServer>
    

    【讨论】:

      猜你喜欢
      • 2018-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-28
      • 1970-01-01
      • 2014-09-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多