application/font-woff2 not working when using Asp.Net VNext

Solution 1:

The file format woff2 is in the mapping list but this was added recently (February 2015) so you may not use a release that contains this change. So to add a custom file format you can use the IIS way using web.config:

<system.webServer>
  <staticContent>
    <remove fileExtension=".woff2" />
    <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
  </staticContent>
</system.webServer>

Or using StaticFilesOptions:

public void Configure(IApplicationBuilder app)
{
    StaticFileOptions options = new StaticFileOptions();
    FileExtensionContentTypeProvider typeProvider = new FileExtensionContentTypeProvider();
    if (!typeProvider.Mappings.ContainsKey(".woff2"))
    {
        typeProvider.Mappings.Add(".woff2", "application/font-woff2");
    }
    options.ContentTypeProvider = typeProvider;
    app.UseStaticFiles(options);
}

Solution 2:

add a mime type declaration to your web.config

<system.webServer>
    <staticContent>
      <mimeMap fileExtension=".woff2" mimeType="application/font-woff" />
    </staticContent>
</system.webServer>

for more info see:

Set mime types for web fonts in IIS

Quick fix: IIS .woff font file 404 not found in asp.net mvc

Solution 3:

If above did not work for you (didn't work for me). Then try with this one :

<mimeMap fileExtension="woff2" mimeType="application/font-woff" />