SVG是不工作的本地主机IIS web服务器 [英] svg is not working on IIS webserver on localhost
问题描述
我试图使用CSS设置了.SVG的形象作为背景图像,但它不工作。 URL是否有效,并返回200状态code和工作在巴纽的图像。
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.
这是什么问题?
推荐答案
您IIS是最有可能与SVG配置为内容类型,尝试添加
Your IIS is most likely not configured with SVG as a content type, try adding
<staticContent>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
在&LT; system.webServer方式&gt;
你的web.config范围
inside the <system.webServer>
scope of your web.config.
当然,这只会如果你的应用是一个服务了 SVG
工作。如果 SVG
未包含您的应用程序中,但在Web服务器中的一个单独的目录,你需要相同的映射添加到您的Web服务器,而不是哑剧里-types标签。
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.
这篇关于SVG是不工作的本地主机IIS web服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!