"NetworkError: 404 Not Found fontawesome-webfont.woff?v=4.0.3 - font-face

I'm getting this error message whenever I load my application page.
I'm using Apache. Following is my css code.
url('../fonts/fontawesome-webfont.woff?v=4.0.3') format('woff')
Firefox throws
"NetworkError: 404 Not Found url.../fonts/fontawesome-webfont.woff?v=4.0.3
While chrome says
GET url.../fonts/fontawesome-webfont.woff?v=4.0.3 404 (Not Found)
Can anyone tell me how to fix this problem?
Thanks in advance.

This worked for me:
Add the following lines to your web.config
<system.webServer>
<staticContent>
<remove fileExtension=".woff"/>
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
</staticContent>
</system.webServer>
You have to add these lines because by default Apache is not configured with .woff as a default MIME-type. Apache default MIME-type
This holds for IIS as well. As Seb Duggan explains here:IIS default MIME, by default .woff files will not be served by the server.

I've updated mime-types in my IIS web server and that resolves my problem.
Extention > .ttf MimeType > application/x-font-ttf
Extention > .woff MimeType > application/x-font-woff
Extention > .woff2 MimeType > application/x-font-woff2
I don't need to change anything in web.config. However, IIS will eventually updates web.config.

I solve it also using adding the file type under handlers on your web.config for any application .net, angular etc you can set a web.config on IIS
<handlers>
<add name="fonts" path="*.woff" verb="*" preCondition="integratedMode" type="System.Web.StaticFileHandler" />
<add name="fonts2" path="*.woff2" verb="*" preCondition="integratedMode" type="System.Web.StaticFileHandler" />
</handlers>

Add "src:" before url, example:-
#font-face {
font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.eot?v=4.7.0');
src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype');
src: url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2');
src: url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff');
src: url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype');
src: url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}

I don't know why the accepted answer did not work for me, But I copied the following configuration to make it work :
<system.webServer>
<staticContent>
<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00"/>
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
</system.webServer>

If you use IIS 6, you can solve your problem by adding Mime to IIS:

If you dont have access to your webserver config, you can also just RENAME the file so that it ends in svg (but retain the format). Works fine for me in Chrome and Firefox.

If none of the solutions above works for you try this solution specified is one of the stackoverflow pages that to set false to BundleTable.EnableOptimizations in BundleConfig.cs file in the App_Start folder.
BundleTable.EnableOptimizations = false;
However, you will lose the benefits of the bundling which reduces the number of http request from your browser.

Related

How to load .gltf in a Blazor application

I am trying to load .gltf model using three.js into my Blazor application.
However the server does not serve this type of files.
I am aware that MIME type must be added, but for some reasons, that cannot be done with Blazor web app as the 'app' variable in Startup.cs is an instance of IComponentsApplicationBuilder. Can anybody help me with this issue.
IIS and IIS Express will not serve files with unknown extensions. In your error console, you see 404 (Not Found) which means either the file is missing, or the MIME type for the file is not registered.
I would recommend you try adding a web.config file to the root of your application, with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".gltf" />
<mimeMap fileExtension=".gltf" mimeType="model/gltf+json" />
<remove fileExtension=".glb" />
<mimeMap fileExtension=".glb" mimeType="model/gltf-binary" />
<remove fileExtension=".bin" />
<mimeMap fileExtension=".bin" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>
</configuration>
The <remove ... /> statements are there to avoid any possible conflicts with any MIME type registrations that happen in parent folders or at the root-level or system-level. It's always safe to remove, but it's a configuration error to add one that already exists.
Here's a reference to where the glTF Mime Type was defined.
Some versions of IIS Express will disregard MIME types from web.config. If this happens, the above file may not work. In that case you may have to edit the IIS Express configuration file directly, to add the information shown above. Check this SO answer to see how to locate that config file.
There's no need to mess around with web.config.
You just need to inject the StaticFileOptions from Program.cs.
using Microsoft.AspNetCore.StaticFiles;
...
builder.Services.Configure<StaticFileOptions>(options =>
{
options.ContentTypeProvider = new FileExtensionContentTypeProvider
{
Mappings =
{
[".gltf"] = "model/gltf+json",
[".glb"] = "model/gltf-binary",
[".bin"] = "application/octet-stream"
}
};
});
Full docs with an alternative option:
https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/static-files?view=aspnetcore-6.0#blazor-server-file-mappings-and-static-file-options

DisableCache in web.config not working on GoDaddy

I recently put a basic site out on GoDaddy, and for obvious reasons, I don't want it caching the HTML files. JSON files and other resources are fine, but not the initial HTML files themselves.
This site was hand-coded in Notepad++; WordPress was not used.
On my local IIS server, the caching for HTML files was disabled without much trouble. This is the web.config file for the overall site:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<remove value="iisstart.htm" />
<remove value="index.htm" />
<remove value="Default.asp" />
<remove value="Default.htm" />
</files>
</defaultDocument>
<caching>
<profiles>
<add extension=".html" policy="DisableCache" kernelCachePolicy="DisableCache" />
</profiles>
</caching>
</system.webServer>
</configuration>
The addelement under caching/profiles works just fine on my IIS server when testing locally. However it's been noticed that it is effectively getting ignored on GoDaddy / Plesk.
So my question is: What do you have to do to get GoDaddy / Plesk to go ahead and stop caching the HTML files?
Try to add below code in your web.config file:
<caching>
<add extension=".html" policy="DontCache" kernelCachePolicy="DontCache" />
</caching>
when you try to access site hard refresh the browser and check that is it working or not.
You could refer this link for more detail.

How do you add a mime type when using ASP.NET vNext?

There's LOADS of information on how to add MIME types into a normal project.
These include configuring IIS, or modifying the web.config.
Both of these options are unavailable to me in vNext with IIS Express.
I had a look at the schema to the project.json file and couldn't find anything in there that would help either.
Can this be done yet? - I want to add a mime type for the .woff2 extension.
If you hosting it on IIS 7 or later then following step will do what you need. This answer I have used Visual Studio 2015 CTP5.
Publish your web application ( ASP.net vnext)
You can publish it to location like C:\MyPublish
Once it get successfully published you will find following location C:\MyPublish\wwwroot. Here You will find web.config.
Now host your site to in IIS ( Make sure that you have used C:\MyPublish\wwwroot as your path)
Now edit web.config over here just like you did for old version to add mime type. ( Following is my edit)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="kpm-package-path" value="..\approot\packages" />
<add key="bootstrapper-version" value="1.0.0-beta2" />
<add key="kre-package-path" value="..\approot\packages" />
<add key="kre-version" value="1.0.0-beta2" />
<add key="kre-clr" value="CLR" />
<add key="kre-app-base" value="..\approot\src\WebApplication5" />
</appSettings>
<system.webServer>
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
</staticContent>
</system.webServer>
</configuration>
Note: As per my thinking In old version it is fix that it is always windows environment so we have direct web.config file in project and we edit that but now we have to follow different process to register as in future we can host completly on linux env as well.
Update : There is another way to do that as well. If you are using Microsoft.AspNet.StaticFiles package then you will have extension.
public void Configure(IApplicationBuilder app)
{
app.UseStaticFiles();
}
This will indirectly use https://github.com/aspnet/StaticFiles/blob/dev/src/Microsoft.AspNet.StaticFiles/FileExtensionContentTypeProvider.cs. Here you can see all mapping.
Update 2: (Add New Mime Type)
public void Configure(IApplicationBuilder app)
{
StaticFileOptions option = new StaticFileOptions();
FileExtensionContentTypeProvider contentTypeProvider = (FileExtensionContentTypeProvider)option.ContentTypeProvider;
contentTypeProvider.Mappings.Add("<<yourextention>>","<<mimetype>>");
app.UseStaticFiles(option);
}
Until this is released, you can also edit applicationhost.config which I found in D:\Documents\IISExpress\config (yours might be on your C drive [Documents]).
I added:
<mimeMap fileExtension=".woff2" mimeType="font/x-woff2" />
Inside <staticContent>.

Video not playing in Firefox on server but will play on local development box

Testing out an updated site with HTML5 and I cannot play video when using Firefox on my hosting server which is running "Windows IIS 8 w/ Plesk on GoDaddy shared". This updated site will run everything properly on my local development server without any issues in Firefox. It was suggested that I create a wev.config file.
I created a web.config file containing the following to update mime mapping:
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<mimeMap fileExtension=".ogg" mimeType="audio/ogg oga" />
<mimeMap fileExtension=".webm" mimeType="video/webm .webm" />
<mimeMap fileExtension=".m4v" mimeType="video/m4v" />
</staticContent>
</system.webServer>
</configuration>
I still cannot get the video to start on the server. Go Daddy suggested I post this. The test site URL www.gslproductions.com/zzzdefault.html
I would appreciate any suggestions.
Best Regards,
e

Running MiniProfiler with runAllManagedModulesForAllRequests set to false

Recently we upgraded to MiniProfiler version 2.0.1 from v1.7, and since then we have not been able to use it in our MVC3 website because when it tries to get its resources, it instead gets a 404.
An example resource call is:
/mini-profiler-resources/includes.js?v=tNlJPuyuHLy/d5LQjyDuRbWKa0weCpmO3xkO6MH4TtA=
In searching around, most people are suggesting that simply setting runAllManagedModulesForAllRequests should be set to true. For giggles, I went ahead and set it to true, and yes it did work. But that is not an acceptable answer.
How can I keep runAllManagedModulesForAllRequests=false and still use MiniProfiler v2?
I had the same issue - the resources being requested use "static" file extensions (such as .js) and therefore IIS wants to handle them using its static file handler.
Luckily all of the MiniProfiler resources are requested with the path mini-profiler-resources, so you can add the following to your web.config:
<system.webServer>
...
<handlers>
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
</system.webServer>
The entry above instructs IIS that any request for the mini-profiler-resources path to be routed through ASP.NET.
As David Duffet says in the comments in the accepted answer, you might also need to add the following entry to your web config. This worked for me:
<system.web>
<httpHandlers>
<add verb="*" type="System.Web.Routing.UrlRoutingModule" path="mini-profiler-resources/*"/>
</httpHandlers>
</system.web>
I had a similar issue and what I did to fix it was change the application pool to 'integrated' and then I added this new line below to my web.config and it then worked.
Here is what the complete web.config looks like now for mini-profiler.
<system.webServer>
<modules runAllManagedModulesForAllRequests="false" />
<validation validateIntegratedModeConfiguration="false"/> <!-- Here is the new line -->
<handlers>
<add name="MiniProfiler" verb="*" type="System.Web.Routing.UrlRoutingModule" path="mini-profiler-resources/*"/>
</handlers>
</system.webServer>

Categories

Resources