在azure节点js web应用程序上找不到字体.woff 404
我在我的nodejs应用程序的控制台上显示了我的wwwroot
上显示的这些字体:
我有我的css
这个用法:
@font-face { font-family: myFont; src: url(resources/font/Montserrat-Bold.woff) format("truetype"); font-weight: bold; } @font-face { font-family: myFont; src: url(resources/font/Montserrat-Light.woff) format("truetype"); font-weight: 300; } @font-face { font-family: myFont; src: url(resources/font/Montserrat-Regular.woff) format("truetype"); font-weight: 400; } @font-face { font-family: myFont; src: url(resources/font/Montserrat-SemiBold.woff) format("truetype"); font-weight: 500; }
html, body{ font-family: myFont; font-weight: 300; }
它在本地主机上工作完美,但即时通讯从我上传的天线版本中得到这个错误。
请通过https://<your-webapp-name>.azurewebsites.net/DebugConsole
访问Kudu工具的控制台,如果使用Express框架,请检查下面的web.config
& server.js
文件。 我认为你需要在css文件中为URL resources/font/...
添加前缀符号/
。
图1. wwwroot
path下的web.config
& server.js
图2. web.config
静态内容的重写规则
图3. server.js
的快速静态路由configuration
IIS服务器节点可能存在一个问题,它不能理解你的字体mimetype。 要解释它如何提供适当的字体,你需要:
- 使用KuDodebugging控制台下载自动生成的web.config文件。
- 将这些行添加到该文件中的适当位置:
<configuration> <system.webServer> <staticContent> <remove fileExtension=".otf" /> <remove fileExtension=".woff" /> <mimeMap fileExtension=".otf" mimeType="font/opentype" /> <mimeMap fileExtension=".woff" mimeType="application/x-woff" /> </staticContent> </system.websServer> </configuration>
希望这可以帮助。
- lwip在azure web应用程序中的node-gyp重build问题:致命错误C1083:无法打开包含文件:'nan.h':没有这样的文件或目录
- 从Node.js中的Azure表存储返回原始实体
- 接收从Node.JS到Azure事件中心的HTTPS请求的ECONNRESET错误
- 从azure eventhub使用node.js消耗八位字节stream数据
- 存储过程受节点mssql对象影响的行
- ExpressJS:自定义错误模块不能识别此错误
- Azure网站node.js http请求失败
- 无法将Node.js从Cloud9 IDE部署到Azure网站
- 使用Azure无服务器函数req.body返回HTML