ASP.NET MVC: after adding this specific static content mime map not loading any other static file in localhost - asp.net-mvc-5

I've added mime map for mp4 video to play in published in app service because it was causing an error "file not found".
Then I added mime map for mp4 now video is playing, but when I run in local, then none of the static content is getting loaded.
My web.config changes for mp4:
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
</staticContent>
When I comment this line in local, then it's working, but then I won't be able to play mp4 videos in app service publish.

Related

Configure well-known folder in MVC 5 Web App?

I'm having problems creating and accessing a well-known folder in an MVC 5 Web App. I need the folder to house some documents for iOS and Android mobile apps.
First, I add a well-known folder to my MVC 5 Web App. I could not add a .well-known folder. Since I could not add the "." in front of the folder, I added a virtual directory using the Azure Portal.
This seems to work, but When I try to access the files using https://portal.mydomain.com/.well-known/apple-app-site-association or this https://portal.mydomain.com/.well-known/assetlinks.json, I get the following message.
"The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
When I try to access just the directory using https://portal.mydomain.com/.well-known/ I get the following message.
"You do not have permission to view this directory or page."
Finally, I added this to my web.config in order to handle the lack of a file extension on the apple-app-site-association file.
<staticContent>
<mimeMap fileExtension="." mimeType="application/octet-stream" />
</staticContent>
Any help is much appreciated. Thanks!
I added a new web.config file to my well-known folder and configured it like so. I can now access both files. This is a new web.config and has nothing to do with the web.config in the root directory. Using this config, the apple-app-site-association downloads a file when I access it using a web browser. The assetlinks.json file displays in the web page, so they behave differently.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension="." mimeType="application/octet-stream" />
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
</configuration>
I commented out this entry in my root directory web.config because I did not need it.
<staticContent>
<mimeMap fileExtension="." mimeType="application/octet-stream" />
</staticContent>

An Issue To get a video file on Azure

I published my website on azure (A Web API) which contains a video file. The problem is I can access to the image file, but I cannot to the .mp4 file and get the following error:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
You must update the web.config by adding the .mp4 mimetype to solve the issue:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>

Even though MIME-Type is set in IIS, cannot disply SVG file

IIS MimeTypes
I have an image tag with an svg file:
<img src="/uploadedImages/temp/Example.svg?n=9368" alt="testsvg" title="testsvg" align="middle">
which won't display in any browser. I can see in Developer Tools that the Content-Type is coming through as application/octet-stream. However, in IIS 7.5, I DO have the MIME-Type set as image/svg+xml (see attached screenshot in link "IIS MimeTypes" above). I also tried setting it in the web.config as follows:
<staticContent>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
but that also did not help. What am I missing? How do I get the correct Mime-type to load so that the image can show in the browser?
(By the way, in IE, if I browse to the file's location, the image DOES show. But not in Chrome and Firefox, they merely want to download the file instead of display it.)

run processing.js on azure web sites

I made a projessing.js application. It works fine in localhost. However, when I deploy my project into my Azure website projessing.js is unable to find my sketch (.pde) file.This is the error message that I get from chrome's console ;
Uncaught Processing.js: Unable to load pjs sketch files: pde/Letter/Letter.pde ==> Invalid XHR status 404
I searched this problem and I found this post about it but I don't know how to make a configuration to my azure.This is the post that I found.I assume it is something related with permissions.
You will need to add the .pde MIME type to your IIS config (web.config file) in Azure. It will look something like the below XML block:
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".pde" mimeType="application/x-processing" />
</staticContent>
</system.webServer>
</configuration>
I'm not sure what the exact mime type is for that file, but the issue is that the MIME type isn't configured, and IIS will block unknown MIME types by default.

Windows Azure ignoring files with unknown extensions

I have uploaded my website to windows azure. The website is working properly on the local server.
I am uploading images to the server.
ISSUE:
If the files had some weird names like 2013_6_5_15_12_33_144pwzve.lg2
Windows azure shows 404 error
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
But works with this file name 2013_6_5_12_1_5_SampleStudent.png
I created some sample page to check if file is uploaded successfully it is.
All the files are on the server.
I checked using grid
grvNotSent.DataSource = Directory.GetFiles(Server.MapPath("~/Test"));
Any idea?
Any help is appreciated
Thanks
what is LG2? Have you added a mime type for that file extension in the web.config?
You can add the mime type mapping like this:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".lg2" mimeType="whatever_this_type_is" />
</staticContent>
</system.webServer>
When IIS sees unknown mime type it ignores the request with 404.

Resources