How to configure IIS 7 to allow downloading .exe files

If you’re getting 404 errors when trying to download .exe files from an IIS 7+ site, the usual culprits are the static-file handler mapping and IIS request filtering. Both are fixed in your web.config.

1. Map .exe to the static file handler

By default IIS doesn’t know how to serve .exe as a downloadable file. Add an explicit handler mapping:

<system.webServer>
<handlers>
	<add name="Client exe" path="*.exe" verb="*" modules="StaticFileModule" resourceType="File" />
</handlers>
</system.webServer>

2. Unblock the extension in request filtering

If you still get a 404, check the exact substatus code. Request filtering denials return 404.7 (“File Extension Denied”) and show up that way in the IIS logs — a plain 404.0 usually means the handler mapping above is missing instead. To explicitly allow the extension, whitelist it under requestFiltering:

<system.webServer>
<security>
	<requestFiltering>
		<fileExtensions>
			<add fileExtension=".exe" allowed="true" />
		</fileExtensions>
	</requestFiltering>
</security>
</system.webServer>

Note that <fileExtensions allowUnlisted="true"> is the default — so this second block is only needed if something (a machine-level config, a hosting provider, or a security baseline) has set allowUnlisted="false" or explicitly denied .exe. That’s exactly the situation most hosts ship with.

The same request-filtering story applies to .dll, .config, and other “sensitive” extensions. Microsoft’s Request Filtering guide documents the full substatus-code table, and the fileExtensions reference covers every attribute. One caution: making executables downloadable is fine, but never let IIS execute them — keep the mapping pointed at StaticFileModule only, as above.

Leave a Reply

Your email address will not be published. Required fields are marked *