Asp.net MVC5 how to download a .hbs file

I am trying to use the (handlebar) .hbs template in an ASP.net MVC5 project, but I cannot load the .hbs file.

it meets HTTP Error 404.3 - Not Found

I load like this,

define [
    'hbs!./index'
],

and I confirmed that the path is ok. (http://local_host:1460/Scripts/js/apps/index/index.hbs)

Do I need to install the .hbs extension somewhere?

Does anyone know please advise me.

+4
source share
1 answer

Yes, you need to tell IIS Express how to handle it .hbs. Just add the following web.config to your project:

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

Source: https://habr.com/ru/post/1525163/


All Articles