Why do all of my .axd files generate a 404 error when on our production server?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
if you’re on IIS7 make sure you add the handler to the <system.webServer><handlers> section:
<add name="MyName" path="MyName.axd" verb="*" type="NameSpace.Class, Assembly" />
Method 2
In my case, I was transferring project from .NET 2.0 using automatic conversion. Converter added the <system.webServer> section and all the handlers and modules that are in the <system.web>. However, for each handler it added the following attribute: preCondition=”integratedMode,runtimeVersionv2.0″
Once I removed the attribute the 404s stopped and handler started to work.
Method 3
You need to create a MIME type for that extension in IIS:
To define a MIME type for a specific extension, follow these steps:
- Open the IIS Microsoft Management Console (MMC), right-click the local computer name, and then click Properties.
- Click HTTP Headers.
- Click MIME Types.
- Click New.
- In the Extension box, type the file name extension that you want (for example, .axed)
- In the MIME Type box, type application/octet-stream.
- Apply the new settings. Note that you must restart the World Wide Web Publishing Service or wait for the worker process to recycle for the changes to take effect. In this example, IIS now serves files with the .axed extension.
Method 4
Confirm that in Request Filtering you either
* have .axd as an Allowed extension, or
* have Allow unlisted file name extensions ticked in Edit Request Filtering Settings
The same effect can be achieved with the following web.config section:
<system.webServer>
<security>
<requestFiltering>
<fileExtensions>
<add fileExtension=".axd" allowed="true" />
</fileExtensions>
</requestFiltering>
</security>
</system.webServer>
Method 5
You can check the following:
- Check in the IIS management console that the .axd extension (the default HTTP handler extension) is allowed.
- Also check if the “Verify if file exists” checkbox is unchecked. This screen appears after you click the “Edit” button after selecting the axd extension.
- Check if the HTTP handler is correctly registered in web.config. It should also be in the right config section depending on the IIS version. For IIS6 and IIS7 Classic mode it should be in
<system.web><httpHandlers>. For IIS7 Integrated mode it should be registered in<system.webServer><handlers>.
Method 6
We had error 500(it is not 404, but who knows) on our production server some time ago. No script resources were able to load.
The problem was in the time difference between our development and production servers. It was -7 hours. .NET threw an exception because of it tried to use a “time in the future” of an assembly with embedded script resources.
Decreasing {website}/bin/ folder (actually assemblies’ in it) creation date by day solved the problem.
Method 7
Can you make a “bad” request that fails and then check the server’s system and application event logs?
There are several issues around axd that can cause 404s or 500s (such as the “time in the future” issue mentioned by Alex), but they leave a footprint in the event log.
Have a look and post any log entries that mention axds.
Method 8
I added a attribute runAllManagedModulesForAllRequests=”true” into modules.. node of the system.webServer section, the 404s stopped and handler started to work.
Method 9
If this will help anyone, I had the same problem, few of us spent 2 days on. On 3 servers everything worked ok and allso on development but on this server 404 non stop. The solution, I changed poold from integrated to classic and that worked
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0