leanhluudan
leanhluudan

Reputation: 63

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.

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).

I build the web site locally in IIS and it had no such problem as the file is loaded successfully. I am sure that the file exists in Azure deployment place.

This URL is ZIP archived project: 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? How could I fix it?

Upvotes: 0

Views: 186

Answers (1)

Stanley Gong
Stanley Gong

Reputation: 12153

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.

To solve this issue , just adding a map record in your web.config file as below : enter image description here

 <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

Pls mark me if it solves your issue : )

Upvotes: 1

Related Questions