This is the solution to fix the IIS error while loading the static files such as css and image files in Windows Server machines.
Step 1: Open “ Turn windows features on or off” in control panel
Step 2: Manage-> Add Roles and Features->next->Next->Next->
Step 3: Under server Roles :
Enable static content in IIS services.
Step 4: Install

Installing the “Static Content” in Server manager will fix the static file problems
Additionally , If you still have the problem with any specific file extension, Please make sure you add the files extension in the Mime Types option in IIS.
Note: Make sure to allow the file extension in the output filtering option as well.