scriptresource.axd 404 error in asp net 4 application - webresource works fine though
Asked Answered
D

13

20

Hey everyone, I have a .net 4 application that i just deployed to production. The app loadas fine, except my referenced js files arent loading properly. Using fiddler I found that the ScriptResource.axd calls are returning 404 errors.

Heres the kicker, the page is also making a call via WebResource.axd, and that request works just fine.

Any ideas what I can check for? Were running IIS7. It is load balanced, but we have machinekeys in the config. I added an httpHandlers section for scriptresource.axd.. but Im still having the same issue.. stumped...

Update - we think ou websrver has no idea what an axd file is. Is there any install for .net that will install the axd mappings in iis?

Dietitian answered 25/1, 2011 at 18:32 Comment(0)
D
2

"404" could also mean (under certain conditions) a "Not enabled" or "not allowed". I had that some time back on a server and had to enable some extension.

Another way would be to use Process Monitor to see whether real files are being searched by the IIS process and not found.

Danais answered 25/1, 2011 at 20:38 Comment(0)
D
11

Looks like handlers needed to be added to system.webserver, per this blog: http://geekswithblogs.net/lorint/archive/2007/03/28/110161.aspx

<system.webServer>
  <handlers>
    <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </handlers>
</system.webServer>

Thanks for the assistance @Uwe Keim

Dietitian answered 25/1, 2011 at 21:33 Comment(0)
D
4

I had the same issue today, but it was caused by a rewrite rule that was rewriting the request from /ScriptResource.axd' to/some_application/ScriptResource.axd', which wasn't a valid target. Correcting the rule to ignore urls with .axd resolved the issue.

Deca answered 16/11, 2012 at 12:34 Comment(1)
This was the source of the issue for me too. Web.config was fine, debug mode didn't help, countless restarts... all along, the error was caused by the poorly written rewrite rules. Thank you David!Anemochore
W
3

This worked for me:

Add the below handler to your web.config:

<system.webServer>
<handlers>
<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="integratedMode" />
Workable answered 15/5, 2014 at 10:48 Comment(2)
This is for IIS 7.x and I don't think you aboslutely need the preCondition="integratedMode".Candelaria
Here is the .NET 4.0 version <add name="ScriptHandler" path=".asmx" verb="" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />Candelaria
G
3

For me, all AXD files were failing. After spending an entire week, trying every answer found on Internet, with no luck:

I created empty files ScriptResource.axd and WebResource.axd, and it solved the issue. I would love to know what the real issue was.

Gaseous answered 16/9, 2014 at 15:43 Comment(0)
D
2

"404" could also mean (under certain conditions) a "Not enabled" or "not allowed". I had that some time back on a server and had to enable some extension.

Another way would be to use Process Monitor to see whether real files are being searched by the IIS process and not found.

Danais answered 25/1, 2011 at 20:38 Comment(0)
B
2

Two possible solutions from http://blogs.msdn.com/b/carloc/archive/2008/12/04/webresource-axd-or-scriptresource-axd-not-working.aspx:

  1. IIS Compression is causing the WebResource.axd requests to fail. Disable compression for the IIS web app and try again.
  2. Web.config for IIS root or specific app has ScriptMaps set to validate *.axd or WebResource.axd is a real file (which it is not). Read the link for fix steps (at least for IIS6 :-)).

Link also has good WebResource.axd background info even if it doesn't directly solve your problem. My problem WebResource.axd 404 problem unfortunately occurs only when Fiddler is running (!), but that is a separate question than the one posted.

Enjoy! -Zephan

Brooch answered 31/1, 2012 at 0:31 Comment(1)
Wayback Machine: web.archive.org/web/20140801041513/http://blogs.msdn.com/b/…Os
B
2

Check that the time on the server is not set to before the time the site was published.

Bordelaise answered 4/2, 2013 at 14:47 Comment(1)
I can't thank you enough for reducing my blood pressure, you have extended my life by several days!Rolanderolando
O
1

I ran into this problem. The above solutions didn't work for me, but what did work was a comment from this page:

This problem comes if your web.config file is not in root folder or the folder is not an application in IIS.

I solved it by copying the web.config file to the root folder of the website.

Og answered 7/12, 2011 at 19:32 Comment(0)
S
1

For me the issue was my server was set to the wrong time. It's date was set to 6/12/2012 instead of 6/21/2013. Fixed the date and poof! it started working :)

Stipend answered 21/6, 2013 at 23:20 Comment(0)
S
1

After spending 4 hours I found a new property on asp.net 4.0 called EnableCdn that basically, if it's set to "true", it loads the resources from the Microsoft content resource servers.

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" 
        ScriptMode="Release" AsyncPostBackTimeout="600" EnablePageMethods="true" EnableCdn="true" />
Sociology answered 29/3, 2019 at 19:27 Comment(0)
P
0

This can be resolved in two ways. One is to set IIS7 application pool setting Manage Pipeline Mode to Classic when using the HttpHandlers setting. If IIS7 and/or IIS7 Express must use Integrated instead of Classic, then we need to use the system.webServer.handlers settings with the precondition attribute set to integrated mode.

This is a common problem when moving some older web apps to cloud hosted environments. For more details see this article:

http://www.ozkary.com/2015/12/404-error-axd-http-handler.html

Hope it helps.

Philibeg answered 22/12, 2015 at 0:1 Comment(0)
M
0

This is my case: I have URL rewrite rules on the web root and I am publishing to an application under the root, which inherits the URL rewrite rules, which redirected all .axd requests to somewhere else. Disabling the rewrite rule in the application folder from IIS manager solved the problem for me.

Multi answered 24/6, 2019 at 13:40 Comment(0)
B
0

I had the same issue and it was caused by the url rewriting module. I commented

<system.webServer>  
<modules>
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />

and site loaded the web and script resource.axd.

Basketball answered 11/7, 2019 at 14:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.