Fixing 404 Error When Loading Scripts in IIS 10 on Windows 10

Abstract: Resolve 404 errors for scripts in IIS 10 by verifying static content installation and configuring correct MIME type mappings.

Created: 2026-10-16 by
A 404 error when loading scripts in IIS 10 on Windows 10 typically stems from incorrect MIME type mappings or improper file path resolution. By configuring the server to recognize JavaScript and CSS extensions, you ensure that static assets are served correctly rather than triggering a "Not Found" response. This guide details the precise steps to resolve these configuration issues within the IIS Manager interface.

Understanding the Root Cause

When Internet Information Services (IIS) receives a request for a file, it checks its internal database of MIME types to determine how to handle the content. If a specific file extension, such as .js for JavaScript or .css for stylesheets, is not mapped to a valid MIME type, IIS may refuse to serve the file. In many default configurations, especially after fresh installations or updates, these mappings might be missing or corrupted. Consequently, the browser receives a 404 status code, interpreting the lack of a valid content handler as an absence of the resource. Another common cause involves the physical location of the files relative to the web root. If your application structure places scripts in subdirectories without proper virtual directory configuration, IIS might fail to resolve the path. Additionally, URL Rewrite rules can inadvertently block access to certain file types if they are configured too restrictively. Before diving into complex rewrites, it is crucial to verify that the basic static content serving capabilities are enabled and that the MIME types are correctly defined.

Verifying Static Content Feature Installation

The first step in troubleshooting is ensuring that the core feature required to serve static files is installed on your Windows 10 machine. IIS does not include all features by default; administrators must explicitly enable them during setup or via Server Manager. To check this, open the Server Manager and navigate to Roles > Web Server (IIS). Click on Add Role or Feature and proceed through the wizard until you reach the Features section. Look for Static Content under the Common HTTP Features group. If this checkbox is unchecked, select it and complete the installation. Without this feature, IIS cannot process requests for HTML, images, or scripts, leading directly to 404 errors for any static asset. If you prefer using PowerShell, you can verify the installation state by running:
Get-WindowsFeature Web-Static-Content
The output should show Installed : True. If it returns False, install it using:
Install-WindowsFeature Web-Static-Content
After installation, restart the IIS service by running iisreset in the command prompt to apply changes.

Configuring MIME Types in IIS Manager

Once the static content feature is active, the next critical step is mapping the file extensions to their corresponding MIME types. This tells IIS exactly what kind of data is being sent to the client. Open IIS Manager and select your server node or the specific site causing the issue. Double-click on the MIME Types icon in the Features View. Scroll through the list to find entries for .js and .css. The standard MIME type for JavaScript is application/javascript or text/javascript, and for CSS, it is text/css. If these entries are missing, click Add... on the right-hand Actions pane. Enter the file name extension with a dot (e.g., .js) and the correct MIME type. Repeat this for any other custom script extensions you use, such as .ts for TypeScript or .map for source maps. Ensure that there are no duplicate entries with conflicting types. Saving these changes allows IIS to serve these files dynamically based on their extension. For sites hosted on different domains or subdomains, you may need to configure MIME types at the site level rather than the global server level to avoid conflicts with other applications. Always test after making changes by refreshing your browser's developer tools network tab to confirm the status code changes from 404 to 200.

Checking File Paths and Virtual Directories

Even with correct MIME types, a 404 error can occur if IIS cannot locate the physical file. Verify that the file exists in the expected directory structure. Common mistakes include case-sensitivity issues, although Windows file systems are generally case-insensitive, some deployment pipelines may alter casing unexpectedly. Check if your scripts are located in a subfolder that requires a virtual directory. In IIS Manager, right-click your site and select Add Virtual Directory. Assign an alias (e.g., scripts) and point it to the physical path containing your JS files. Update your HTML references to use this alias, such as /scripts/app.js. Additionally, inspect the URL Rewrite module if you have active rules. A rule might be redirecting or blocking requests to static files. Disable rewrite rules temporarily to see if the scripts load correctly. If they do, adjust the rule conditions to exclude static file extensions like \.js$ or \.css$ from processing. This issue shares similarities with general connectivity problems seen in other Windows 10 services, where underlying system components fail to communicate properly due to misconfiguration. For more insights on resolving broader Windows 10 service errors, you might find our article on Unexplained Slowness on Windows 10 PC helpful, as it covers diagnostic techniques applicable to various service failures.

Frequently Asked Questions

Why do I get a 404 for .js files but not .html?

HTML files are usually handled by the default document handler or generic static content processing which is often pre-configured. JavaScript files require explicit MIME type mappings in many IIS versions. If the mapping is missing, IIS treats the request as invalid or unknown, resulting in a 404 error instead of serving the text content.

Can I set MIME types via web.config instead of IIS Manager?

Yes, you can add MIME types directly in your web.config file under the <system.webServer> section. Use the <staticContent> element to define new mappings. This method is useful for portability, ensuring that the configuration travels with your application code rather than relying on server-level settings.

Does restarting IIS clear the cache?

Running iisreset stops and starts all IIS services, which effectively clears the configuration cache and reloads all modules. This is necessary after changing MIME types or installing new features to ensure the changes take immediate effect without requiring a full server reboot.

How do I troubleshoot if MIME types are correct but still 404?

If configurations are correct, check the physical file permissions. Ensure the IIS user account (IUSR or the application pool identity) has read access to the folder containing the scripts. Lack of NTFS permissions will result in a 404 or 403 Forbidden error depending on the specific failure mode.

Are there security risks in adding broad MIME types?

Adding overly permissive MIME types can expose your server to cross-site scripting (XSS) attacks if users can upload files with executable extensions. Always restrict MIME types to only those required by your application. Avoid mapping dangerous extensions like .exe or .bat to web-accessible directories unless absolutely necessary and secured.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More