简体   繁体   English

在Azure上部署的Web无法访问.less文件(错误代码404)。 本地IIS部署可以正常工作

[英]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.

相关问题 新部署的 Azure Web 应用程序返回 404 错误代码 - New deployed Azure web app is returning 404 Error code HTTP 错误 404:在 IIS 上部署 Web API(最小 API NET 7) - HTTP Error 404: Deployment of a Web API (minimal API NET 7) on IIS 如何解决部署到本地文件的 asp.net web api 的 404 错误 - How to resolve a 404 error for a asp.net web api deployed to a local file 尝试在IIS 8.5上使用HTTPS访问目录但无法使用HTTP时,找不到404服务器错误资源 - Server Error Resource cannot be found 404 when trying to access directory using HTTPS on IIS 8.5 but works using HTTP C# 方法适用于本地 Web 服务器,但不适用于 azure Web 应用程序。 找不到文件错误 - C# method works in local web server but not in azure web app. File not found error 在IIS 8.5上部署后,文件上传Web API 2.0错误 - File upload web api 2.0 error after deployment on IIS 8.5 本地数据库的 IIS Razor 站点部署错误 - IIS Razor site deployment error with local db 从一台计算机而不是另一台计算机部署时,C#Web应用程序在Azure中导致404错误 - C# web application causes 404 error in Azure when deployed from one computer, but not from another Net Core 部署的应用程序在 IIS 上引发错误 404 - Net Core deployed app throws error 404 on IIS IIS 7.0 Web服务-在HTTP(80)上运行,在HTTPS(443)上失败,错误404 - IIS 7.0 Web Service - Works on HTTP (80), Fails with error 404 on HTTPS (443)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM