Svgs和其他MIME类型在Windows Azure中 [英] Svgs and other mime types in windows azure

查看:315
本文介绍了Svgs和其他MIME类型在Windows Azure中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

喜IM在Windows Azure上建立一个网站在的NodeJS,并希望包括SVG的背景图像。如何允许svgs和MIME类型有什么看法?

Hi im setting up a website in nodejs on windows azure, and would like to include svg's as background images. how do i allow svgs and mimetypes in general?

推荐答案

天青使用 IISNode

我添加了这个web.config文件以获得svgs工作。
它可以被修改为其他MIME类型

I added this web.config file to get svgs working. It can be modified for other mime types

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".svg" mimeType="image/svg+xml"/>
    </staticContent>
    <handlers>
      <add modules="iisnode" name="iisnode" path="server.js" verb="*"/>
    </handlers>
    <rewrite>
      <rules>
        <rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="^[a-zA-Z0-9_\-]+\.js\.logs\/\d+\.txt$"/>
        </rule>
        <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="^server.js\/debug[\/]?"/>
        </rule>
        <rule name="StaticContent">
          <action type="Rewrite" url="public{REQUEST_URI}"/>
        </rule>
        <rule name="DynamicContent">
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
          </conditions>
          <action type="Rewrite" url="server.js"/>
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

这篇关于Svgs和其他MIME类型在Windows Azure中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆