Cant access a file from azure website - asp.net

http://abcds.azurewebsites.net/scripts/abdsk.json
This file is available in the azure. But when i go to "http://abcds.azurewebsites.net/scripts/abdsk.json" i get a response back saying
GET http://abcds.azurewebsites.net/scripts/abdsk.json 404 (Not Found)
What might be the cause?

By default, Azure won't serve certain file types. You have to explicitly include the MIME type in order for Azure to serve the file.
In your Web App's web.config, add the following in the section:
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>

Related

Why does my ASP.NET webpage throw custom 404 error with certain file extensions

So, I have a folder on my server such like this:
You can access this resources by the URL:
Image:
Text:
But the kmz, instead of opening the file (maybe like the text in the xml, I'm not expecting to visualize it) it returns a strange 404:
Is there any way of allowing all files to be accessed without an error?
Thank you very much.
As far as I know, if you wants to access the kmz file in the browser, you will face 404.3 error.
Error details:
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.
To solve this issue, you should add the MIME map for kmz file.
I suggest you could add below config file into the web.confil, then it will work well.
<system.webServer>
<staticContent>
<remove fileExtension=".kml" />
<mimeMap fileExtension=".kml" mimeType="application/vnd.google-earth.kml+xml" />
<remove fileExtension=".kmz" />
<mimeMap fileExtension=".kmz" mimeType="application/vnd.google-earth.kmz" />
</staticContent>
</system.webServer>

My website hosted in the local iis can't load images, js and other files

I am totally new to IIS and this is my first attempt to host one of my websites on my own machine's IIS server.
I installed IIS using Add windows features on or off feature and used aspnet_regiis -i to install asp on it.
Then I copied my website's content to wwwroot directory and I have a partially working website, because some fonts, images, js files and a webm file can't be loaded into the page and when I go to these files by url I get this error message:
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.
I should mention that I checked static content under common http features in Add windows features on or off but still I have the same problem
Thanks in advance for your help
UPDATE:
I used to have a host and domain and this website worked perfectly there, So it Not a website problem
UPDATE2
some pictures load ok and some don't.some fonts are ok and some don't.chrome's developer console states an 404 error message for missing files and scripts and when I go to them via url,I get the error message above(which indeed is a 404 error message)
UPDATE3
I added woff and webm formats to MIME types so now these types of files work.But still some javascript files won't work since they are using json I json format and json is not added yet to the list of MIME types
What can I do so that ALL TYPES OF FILES are allowed?
Modify your web.config like
<system.webServer>
<staticContent>
...
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
...
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>

IIS Express won't download .coffee files

I just enabled source maps because, sure why not, I'd like to try them out. However, I'm finding that IISExpress will not download .coffee files so it doesn't work.
I'm sure it's a simple web.config modification, I'm just not sure which one. How do I configure it to serve these?
All of IIS Express's configuration is done through the configuration files; in this case you want
C:\Users\[user]\Documents\IISExpress\config\applicationhost.config
In that file, there's a list of all of the static content types that IIS Express knows about and is willing to serve. You just need to add your extension to that list. The list starts about 1/2 down the file, in this XML element:
<staticContent lockAttributes="isDocFooterFileName">
It should be pretty obvious what to do from there: just map.coffee files to the correct mime type.
<mimeMap fileExtension=".coffee" mimeType="text/plain" />
This element is found within the system.webServer element, which is one of the ones that supports delegation to individual web.config files, so you should be able to add a similar XML block to your project's configuration file:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".coffee" mimeType="text/plain" />
</staticContent>
</system.webServer>

Roxy Fileman with CKEditor doesn't work after upload to server

I have to use any file manager on my website. I chose Roxy Fileman, because it is compatible with CKEditor, which is my main text editor. The problem is, everything works when i test it on my localhost, but after publishing it on server I get error message: "The page cannot be displayed because an internal server error has occurred." There's no more info... Have you guys any idea what I should do?
1) make sure Fileman folder is added to the directory
2) go to Fileman folder and in web.config add below code into the staticContent tag
<!--Cache static content for 24 hours-->
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="24.00:00:00" />
<!--Allow json file loading (used by Roxy Fileman)-->
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="application/json" />
3) and finaly make sure Fileman has permission to write data
I had the same exact problem and after much research and diagnosing, this worked for me.
In the fileman directory, there is a web.config file. Open it in your text editor and you will see the following line:
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json"/>
</staticContent>
Delete it from the web.config and save. It is conflicting with something on the live server where this configuration is already being set. I hope this helps anyone.

Possible to add MIME type to web.config without possibly breaking the site?

I had a web.config in one of the websites on my IIS that was adding a support for .7z file extension. When I later added a global .7z support at the server level, this site was broken - IIS Manager is complaining that it "cannot add duplicate collection entry of type 'mimeMap'..." and all web requests to i.g. CSS files ended with an HTTP 500 error.
I was using this in the site's web.config:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".7z" mimeType="application/x-7z-compressed" />
</staticContent>
</system.webServer>
Is there maybe some other syntax that would add 7z to the list only if it wasn't defined yet?
According to this, you should remove the global setting in the special config before adding it in a different form.
Explcitly:
<system.webServer>
<staticContent>
<remove fileExtension=".7z" />
<mimeMap fileExtension=".7z" mimeType="application/x-7z-compressed" />
</staticContent>
</system.webServer>
Of course this doesn't really help you now as you might just as well drop the local setting completely (as it's likely to coincide with the global setting). But if you had known this back when you added local 7zip support, you wouldn't have encountered the error now ...

Resources