[英]Deployed web on Azure cannot access a .less file (error code 404). Local IIS deployment works without error
I deployed a website in https://pokegotool.azurewebsites.net . 我在https://pokegotool.azurewebsites.net中部署了一个网站。
However, when I use a browser to access it and read the browser console, it told that the "Content/pre-css/styles.less" file is inaccessible (error code 404). 但是,当我使用浏览器访问它并阅读浏览器控制台时,它告知“ Content / pre-css / styles.less”文件不可访问(错误代码404)。
I build the web site locally in IIS and it had no such problem as the file is loaded successfully. 我在IIS中本地构建了该网站,但没有问题,因为文件已成功加载。 I am sure that the file exists in Azure deployment place.
我确定该文件存在于Azure部署位置。
This URL is ZIP archived project: https://www.mediafire.com/file/i6745pz5j43cw2z/RangeGen.zip/file 该URL是ZIP存档项目: https : //www.mediafire.com/file/i6745pz5j43cw2z/RangeGen.zip/file
Feel free to use it. 随意使用它。
Is this an error from Azure or from my project itself? 这是Azure还是我的项目本身的错误? How could I fix it?
我该如何解决?
I have deployed your project and met the same issue . 我已经部署了您的项目并遇到了同样的问题。 Basically , it is due to that Azure app service IIS server have not mapped correct MIME type for .less files by default.
基本上,这是由于默认情况下Azure应用服务IIS服务器没有为.less文件映射正确的MIME类型。
To solve this issue , just adding a map record in your web.config file as below : 要解决此问题,只需在您的web.config文件中添加一个地图记录,如下所示:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".less" mimeType="text/plain" />
</staticContent>
</system.webServer>
It works on my app service , try it here : https://rangegen20190902101335.azurewebsites.net/Content/pre-css/styles.less 它适用于我的应用程序服务,请在此处尝试: https : //rangegen20190902101335.azurewebsites.net/Content/pre-css/styles.less
Pls mark me if it solves your issue : ) 请标记我是否可以解决您的问题:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.