13

Why do all of my .axd files generate a 404 error when on our production server?

MPelletier
  • 16,256
  • 15
  • 86
  • 137
januszstabik
  • 1,152
  • 5
  • 16
  • 30

9 Answers9

16

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" />
7

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.

Greg Z.
  • 1,376
  • 14
  • 17
6

You need to create a MIME type for that extension in IIS:

To define a MIME type for a specific extension, follow these steps:

  1. Open the IIS Microsoft Management Console (MMC), right-click the local computer name, and then click Properties.
  2. Click HTTP Headers.
  3. Click MIME Types.
  4. Click New.
  5. In the Extension box, type the file name extension that you want (for example, .axed)
  6. In the MIME Type box, type application/octet-stream.
  7. 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.
Alex
  • 1,576
  • 2
  • 15
  • 28
  • Nope its not that. I have a feeling that the server is stripping out querystring parameters from .axd files and .asmx files as my webservices dont work either. Is anybody aware of something that would prevent this (no its not the verb missing from the extension as this generates a different error) – januszstabik Jul 09 '09 at 09:27
  • What version of IIS are you running? – Alex Jul 09 '09 at 12:32
  • I'm thinking you might have a permissions issue? Can you see anything else on that server? .aspx? Anything? – Alex Jul 09 '09 at 14:17
  • 5
    Why did you say "Nope it's not that" and then accept this answer? – Jay Sullivan Sep 15 '14 at 15:11
  • @januszstabik May have been experiencing an issue with **UrlScan**. Check logs at **C:\Windows\System32\inetsrv\urlscan\logs** For example in the log file, this URL is rejected for having -- (2 dashes). `GET /WebResource.axd?d=blahblah--blahblah&t=12345678900000000 Rejected disallowed+query+string+sequence query+string - --` Modify **C:\Windows\System32\inetsrv\urlscan\UrlScan.ini** to permit the URL `[AlwaysAllowedUrls] /WebResource.axd` – bdeem Apr 23 '15 at 18:06
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>
RB.
  • 36,301
  • 12
  • 91
  • 131
  • I wanted to do the opposite, so this was perfect (obviously, I just used `false` in place of `true`). – Fenton Jun 17 '16 at 13:53
3

You can check the following:

  1. Check in the IIS management console that the .axd extension (the default HTTP handler extension) is allowed.
  2. 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.
  3. 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>.
SilentGhost
  • 307,395
  • 66
  • 306
  • 293
Atanas Korchev
  • 30,562
  • 8
  • 59
  • 93
2

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.

Oleks
  • 31,955
  • 11
  • 77
  • 132
0

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.

Rob Levine
  • 40,328
  • 13
  • 85
  • 111
0

I added a attribute runAllManagedModulesForAllRequests="true" into modules.. node of the system.webServer section, the 404s stopped and handler started to work.

Quynh Nguyen
  • 61
  • 1
  • 2
0

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

Nikola Gaić
  • 117
  • 1
  • 11
  • This possibility depends on the application. In my case I could not switch to classic because the app refused to run under classic mode. – John Ranger Mar 21 '20 at 21:13