ASP.NET MVC 5 on Azure: "The resource you are looking for has been deleted ..." for SVG files

I created an MVC 5 webpage with some views and controllers, added some images (gif and svg) and verified that it mostly works locally. Images appear and everything behaves as expected.

When I deploy to Azure the gif image loads fine, but the svg images give me the error The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

When I login to my site's FTP site with my Azure credentials, all the gif and svg files. I can access my file /img/loading.gif

from the Internet just fine; however /img/logo.svg

- while it has in the directory and does when I run locally - not found when served up on my Azure website.

I don't think this is appropriate, but I tell you that my site redirects existing files:

routes.RouteExistingFiles = true;

      

And all my images - gif and svg - are located in Solution 'mySolutionName' -> myMvcProjectName -> img

. So I don't see anything that instructs my site to handle these files differently.

+3


source to share


1 answer


It turns out this is an issue with staticContent

MIME types, as in this answer to the question .

To fix, I found a section of <system.webServer>

mine Web.config

:

   <system.webServer>
     <modules>
       <remove name="FormsAuthentication" />
     </modules>
   </system.webServer>

      



And added mapping <staticContent>

for SVG using the appropriate MIME type:

   <system.webServer>
     <modules>
       <remove name="FormsAuthentication" />
     </modules>
     <staticContent>
       <mimeMap fileExtension="svg" mimeType="image/svg+xml" />
     </staticContent>
   </system.webServer>

      

+4


source







All Articles