Failed to load resource: the server responded with

2019-09-11 06:23发布

问题:

I am working with bootstrap, it's working fine then suddenly this error appears

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:5266/Content/fonts/glyphicons-halflings-regular.woff2

<link href="../Content/css/StyleSheet.css" rel="stylesheet" />
<link href="../Content/css/bootstrap.min.css" rel="stylesheet" />
<link href="../Content/css/bootstrap-theme.min.css" rel="stylesheet" />

<script src="../Script/js/jquery-2.2.1.min.js"></script>
<script src="../Script/js/bootstrap.min.js"></script>

please help me out.

回答1:

Try changing your links from ../ to ./.

You can refer on this answer, or search more about file paths.



回答2:

I'm aware this question was asked a while ago; I'm commenting to save others time.

The error is probably because the web server default configuration cannot handle the unexpected file type of woff2.

Add this inside the web.config file, 'configuration' tags:

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

Thanks to: Will Strohl