HTTP Error 404.3 - Not Found in DotNet - asp.net

When I am requesting the json file using ajax from dotnet application I got this error:
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
Please share the solution

Implement below code in `web.config` file. Use the file extension that you want to fetch
For Example: here is .json file
<system.webServer>
<staticContent>
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>

Related

Why IIS8.5 try use dynamic compression for static JSON and SVG files?

I have one more question about IIS compression
I have static file ../wwwroot/src/locale/en-us.json and sgv
But IIS8.5 recognizes it as a dynamic content and try to use dynamic compression
What I must do to force IIS works with .json and .svg in the same way like .js and .css
The issue was in mime types, by default IIS doesn't apply dynamic compression for application/json and xml/svg+xml
I don't have access to web server configuration and I made a workaround in local web.config
<staticContent>
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="text/json" />
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="text/svg+xml" />
</staticContent>

I get tons of these in my errorlog 'The controller for path X was not found or does not implement IController

Im a bit confused of why I keep getting these error messages in my error log:
The controller for path '/fonts/fontawesome/fontawesome-webfont.woff' was not found or does not implement IController.
and
The controller for path '/css/bootstrap.css.map' was not found or does not implement IController.
I get about 4 hits every minute so its filling up my error log pretty fast.
I had a similar issue with woff files that I noticed on the browser end returning 404, and you simply need to identify these files as static content in your Web.config:
<system.webServer>
<staticContent>
<mimeMap fileExtension="woff" mimeType="application/font-woff" />
<mimeMap fileExtension="woff2" mimeType="application/font-woff" />
<mimeMap fileExtension="map" mimeType="application/json" />
</staticContent>
</system.webServer>

How to allow .config, .map, .browser files to be downloaded IIS

ITo download updates for a game, I've configured IIS 7.5 to download any type of file such as .html, .xml, .aspx etc. But there is one problem.
I am not able to download the files of type .map, .browser, .config. Actually these are files related to game. Without these files the update doesn't complete.
Can you please help me in solving these issues.
You need to add MIME types for these extensions.
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".config" mimeType="text/xml" />
<mimeMap fileExtension=".map" mimeType="text/plain" />
<mimeMap fileExtension=".browser" mimeType="text/plain" />
</staticContent>
</system.webServer>
</configuration>
On side note making these file available to client may cause serious security threat.

Registering MIME type in web.config not working?

I encountered a problem with 404 error messages on .woff files that seemed easily fixable from here. I opted to go the route of registering the MIME type in my web.config file so I wouldn't have to remember to update the production site with a new registration when the application I'm building was deployed.
I added the following lines to my web.config file:
<system.webServer>
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
</staticContent>
...
</system.webServer>
... and then I deployed. However, contrary to all the documentation I've read on this, it appears that this doesn't work. I still get the 404 error. Manually updating the IIS site (2008R2, IIS 7.5) and registering the MIME type fixed the issue, but it certainly didn't want to play nice with my web.config settings.
Is there an extra step I'm missing to get this to register solely with the web.config?
Try replace,
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
by,
<mimeMap fileExtension=".woff" mimeType="font/x-woff" />
#Venkat (cannot comment due to too low rep)
That would be stupid, considering the official MIME-type is application/font-woff.
Source: http://www.w3.org/TR/WOFF/#appendix-b

404 on static content (svg,woff,ttf) on Azure

I am trying to add bootstrap glyphicons-halflings-regular.svg to my web site. Locally everything works fine, but on Azue I have 404 errors:
The resource you are looking for has been removed, had its name
changed, or is temporarily unavailable.
or when I add below staticContent section to my web.config
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
<remove fileExtension=".ttf" />
<mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
I got this error:
The controller for path
'/Content/fonts/glyphicons-halflings-regular.woff' was not found or
does not implement IController.
How should I proper configure my ASP.NET site to avoid above errors?
I hit the same problem with .woff file. Solution with adding that extension to web.config works fine:
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension="woff" mimeType="application/font-woff" />
</staticContent>
</system.webServer>
(see oryginal solution: http://www.codepal.co.uk/show/WOFF_files_return_404_in_Azure_Web_Sites)
When I put the suggested lines into web.config it didn't work. Instead I put the following lines into Web.config (note the capital letter)
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension="woff" mimeType="application/font-woff" />
<mimeMap fileExtension="woff2" mimeType="application/font-woff" />
</staticContent>
</system.webServer>
I did not include font files in solution. This caused that publishing website does not contains this files.
If you are using the continuous deployment on Azure, verify that the "build action" of all the files that you need is Content and not None.
Have you fixed the paths in the css file that are referring to the font files? Bootstrap assumes that the css file is inside a css directory and fonts is inside a fonts-directory on the same level as the css-directory.
When you run in Azure, the site is probably running in Release-mode. This means that your css and javascript is minified and bundles. This may break your setup sometimes.
I've done the following setup when including bootstrap in my projects:
Unzip bootstrap files into the /Content directory.
Add the following lines to App_Start/BundleConfig.cs
bundles.Add(new StyleBundle("~/Content/bootstrap/css/bundle")
.Include("~/Content/bootstrap/css/bootstrap.css"));
bundles.Add(new ScriptBundle("~/Content/bootstrap/js/bundle")
.Include("~/Content/bootstrap/js/bootstrap.js"));
Add the following lines to View/Shared/_Layout.cshtml
#Styles.Render("~/Content/bootstrap/css/bundle")
#Scripts.Render("~/Content/bootstrap/js/bundle")
Note that jQuery must be included before the Bootstrap js-bundle.
http://hj-dev.blogspot.no/2013/02/add-twitter-bootstrap-to-mvc4.html

Resources