防爆preSS中的NodeJS web.config中的Azure为SVG和放大器;字体 [英] Express NodeJS web.config in Azure for SVG & Fonts
问题描述
我在防爆preSS网站的NodeJS一个问题,我做,我使用SVG和其他文件,如字体。
I had a problem in an Express NodeJs website I make where I use SVG and other files like Fonts.
当我在本地运行应用程序,我没有问题。但是,当我不得不把它在Azure上,如SVG和字体的所有文件没有出现了。
When I ran the app locally I didn't have problem. But when I had to put it on Azure, all files like SVG and Fonts did not appear anymore.
我在项目的根目录中创建一个web.config文件:
I created a web.config file at root of project :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".woff" mimeType="application/x-woff" />
<mimeMap fileExtension=".ttf" mimeType="application/x-woff" />
</staticContent>
</system.webServer>
</configuration>
也做,因为他们告诉这里( Svgs和其他MIME类型Windows Azure的)
这两种解决方案允许我访问SVG文件,但问题是,现在我不能看到我的网页! (HTTP 500)
Both solutions permit me to access SVG files, but the problem is that now I am not able to see my webpages ! (HTTP 500)
看来它覆盖配置动态内容。
前人的精力有什么我能做的动态内容配置重新工作?
It seems it overrides configuration for dynamic Content. What sould I do to configure dynamic Content to work again ?
推荐答案
我发现这个问题。这很简单。
我需要在这里使用该解决方案在Windows Azure中( Svgs和其他MIME类型)
I found the problem. Which was simple. I needed to use the solution here (Svgs and other mime types in windows azure)
但在动态内容的配置,而不是调用的 server.js ,我需要调用的 app.js 后,因为我的前preSS网站,它运行在app.js(默认值)。
But in the configuration of the Dynamic Content, instead of calling server.js, I needed to call app.js, because of my Express website, which runs in app.js (default).
的最终结果是:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".woff" mimeType="application/x-woff" />
<mimeMap fileExtension=".ttf" mimeType="application/x-woff" />
</staticContent>
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<rule name="DynamicContent">
<match url="/*" />
<action type="Rewrite" url="app.js"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
这篇关于防爆preSS中的NodeJS web.config中的Azure为SVG和放大器;字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!