0

All of a sudden my SVG files don't get displayed properly when browsing my MVC 4 site. They work fine in other projects and the same project displays the images fine when hosted in IIS instead of ASP.NET Development Server. I tried adding the MIME using the code below but it didn't change anything. It feels like this literally happened over night. Really confusing.

<staticContent>
  <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
tereško
  • 58,060
  • 25
  • 98
  • 150
Misbit
  • 347
  • 2
  • 20
  • 1
    http://stackoverflow.com/questions/5924647/setting-mime-types-using-the-asp-net-development-server – xrnd Apr 22 '14 at 12:05
  • Didn't really understand what to do with the snippet of code that was presented but I took the first advice and installed the full version of IIS instead. – Misbit Apr 22 '14 at 12:33
  • MIME types are hard coded for ASP.NET Deployment Server. The code snippet, is just a proof of this. Adding MIME types in your web.config won't affect the Deployment Server since it does not understand tag itself. Bottom line: Use IIS – xrnd Apr 22 '14 at 12:37
  • How is it possible that it worked as late as last week? And my other projects run without problems? – Misbit Apr 22 '14 at 12:46
  • 1
    That is difficult to comment on but you can check this out http://blogs.msdn.com/b/scicoria/archive/2011/10/06/additional-mime-types-in-visual-studio-2010-development-web-server.aspx – xrnd Apr 22 '14 at 12:50

1 Answers1

1

the best way to call svg files is this:

<object data='svg-test.svg' type='image/svg+xml' width='500' height='500' />
Igor Monteiro
  • 933
  • 1
  • 11
  • 29