Adding DotLess as a NuGet package to an ASP.NET MVC 5 application causes IIS 8 Internal Server Error 500
Posted: (EET/GMT+2)
I'm a fan of the DotLESS NuGet package in my Visual Studio ASP.NET MVC applications, and use it in many different projects, both internal and client projects. Now, there's one catch in using the package out of the box: it makes web.config configuration changes that are not compatible with current IIS versions, both on-premises and on Azure.
The fix is trivial, but you have to know where to look. The symptoms are like this:
HTTP Error 500.23 - Internal Server Error An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
This error is caused by an incorrect web.config entry that gets added by the NuGet package installer. The line you need to remove (or comment out) is in section "System.Web":
After you remove this line, the application will launch without errors.
Note that a similar line is added to the section "System.WebServer". Leave this line as is.