在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>
希望这可以帮助。
- Grunt无法在Azure网站上运行
- 如何获得插入查询logging集
- 如何使用AMQP在“PeekLock”模式下从Azure服务总线队列获取消息?
- 如何在使用Kudu将node.js应用程序部署到Azure时debuggingdeploy.sh?
- 使用Azure移动服务计划任务访问Azure服务pipe理REST API
- 通过Git部署简单的SPA到Azure
- 如何将React.js / React Native Apps连接到Azure App Service的单个后端实例?
- 连接到Azure移动服务上托pipe的Socket.IO服务器返回错误
- 在MS Bot Framework机器人中获取Azure Active Directory用户的数据