Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

svg is not working on IIS webserver on localhost

Tags:

css

asp.net

iis

svg

I'm trying to set a ".svg" image as background-image using css, but it is not working. The url is valid and returns 200 status code and works on ".png" images.

What is the problem?

like image 817
HasanAboShally Avatar asked Sep 08 '12 06:09

HasanAboShally


2 Answers

Your IIS is most likely not configured with SVG as a content type, try adding

<staticContent>     <mimeMap fileExtension=".svg" mimeType="image/svg+xml" /> </staticContent> 

inside the <system.webServer> scope of your web.config.

This will of course only work if your application is the one serving up the svg. If the svg is not contained inside your application but in a separate directory of the web server, you'll need to add the same mapping to your web server instead inside the "mime-types" tab.

like image 130
Joachim Isaksson Avatar answered Sep 17 '22 15:09

Joachim Isaksson


Try This - Your App/Website under Default Settings of IIS Manager

 Default Site Under IIS Manager

Then "Add" -> { .svg : image/svg+xml }

like image 44
Vintesh Avatar answered Sep 18 '22 15:09

Vintesh