AjaxPro is working locally, but on server I am getting .ashx errors

17k Views Asked by At

Locally my application works fine using ajaxpro, but on the server I can't seem to figure out why it is not working.

using firebug I have the following erros:

GET prototype.ashx 404 not found GET core.ashx 404 not found GET ms.ashx 404 not found

Same code works locally, so it must be a IIS7 setting?

edit, my web.config

<httpHandlers>
            <add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
        </httpHandlers>

also have:

<location path="ajaxpro">
        <system.web>
            <httpHandlers>
                <add verb="POST,GET" path="*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
            </httpHandlers>
            <authorization>
                <allow users="*"/>
            </authorization>
        </system.web>
    </location>

and:

<location path="ajaxpro/prototype.ashx">
        <system.web>
            <authorization>
                <allow users="*"/>
            </authorization>
        </system.web>
    </location>
    <location path="ajaxpro/core.ashx">
        <system.web>
            <authorization>
                <allow users="*"/>
            </authorization>
        </system.web>
    </location>
    <location path="ajaxpro/converter.ashx">
        <system.web>
            <authorization>
                <allow users="*"/>
            </authorization>
        </system.web>
    </location>
7

There are 7 best solutions below

0
On
<configuration>

    <location path="ajaxpro">
        <system.webServer>
            <handlers>
                <add verb="*" path="*.ashx" name="AjaxPro"
                     type="AjaxPro.AjaxHandlerFactory,AjaxPro.2" />
            </handlers>
        </system.webServer>
    </location>

</configuration>

Windows 2008 \ IIS 7 doesn't have the axd handler mapping set up by default for using Ajax so you need to put the following code into your web.config file if you want to use Ajax and are on one of our Windows 2008 hosting plans.

<system.webServer>
        <handlers>
            <add name="Ajax" path="*.axd" verb="*" modules="IsapiModule"
scriptProcessor="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"
resourceType="Unspecified"
preCondition="classicMode,runtimeVersionv2.0,bitness32" />
        </handlers>
</system.webServer>

or copy the .dll to the bin folder and try that:

<httpHandlers>
<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>

</httpHandlers> in <system.web>
0
On

I got this error ( ajaxpro/core.ashx 404 not found) after migrating my webform to MVC 4

I solved it adding this line to my app_start/routeconfig

routes.IgnoreRoute("ajaxpro/{*pathInfo}");

My web.config didn`t need extra declarations but this one

<httpHandlers>
        <add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
    </httpHandlers>

and of course, a reference to ajaxpro.2.dll placed in my bin folder

Hope this to be usefull !

0
On

Are you sure that you have the handlers registered properly in the web.config file?

You should have something that looks like the following in your web.config file.

<location path="ajaxpro">
    <system.web>
        <httpHandlers>
            <add verb="*" path="*.ashx"
                 type="AjaxPro.AjaxHandlerFactory,AjaxPro.2"/>
        </httpHandlers>
    </system.web>
</location>

You also need to have the AjaxPro dll in your Bin directory (for a web site, at least).

0
On

For AjaxPro.dll to work in IIS7 you should set your application pool's PipelinMode to Classical instead of Integrated.

I have tried everywhere to find this but at the end this was what saved me.

1
On

I've been banging my head against this issue for a couple of hours, and I think I may have just found a solution... and it's rather, errr... frustrating.

In web.config, system.webServer/handlers, there may be more than one item that handles *.ashx

eg:

<add name="AjaxPro" verb="POST,GET,HEAD" path="ajaxpro/*.ashx" ...
<add name="SimpleHandlerFactory-Integrated" path="*.ashx" ...
<add name="SimpleHandlerFactory-ISAPI-2.0" path="*.ashx" ...
<add name="SimpleHandlerFactory-ISAPI-2.0-64" path="*.ashx" ...

If the ajaxpro entry is below these, it will not be used, as these entries match first. Moving the ajaxpro entry above the others might solve the problem.

I have no idea why cassini doesn't mind, but IIS7 does...

0
On

I just had the same error but probably for a different reason than you did. I got it on a new website (running locally) because the website was using a custom url rewrite module that didn't exclude .ashx!

So the solution for me was to make sure the rewrite module excluded paths with .ashx...

2
On

To run Ajax.NET on IIS7 (i.e. Windows Vista) in integrated mode instead of classic mode here are two things you have to check:

  1. First check that the IIS_ISSRS group has access to your Web site folder. If you are using the default folder for Web sites with Visual Studio .NET 2005 the simplest way is to add read access at C:\Users\Username\Documents\Visual Studio 2005\WebSites.
  2. Run following command to automatic migrate your web.config file: %windir%\system32\inetsrv\Appcmd migrate config ""

The breaking change for Ajax.NET Professional is that you have to move the httpHandler (and httpModule if used) to a new section system.webServer and rename httpHandler to handler; next you have to add a name attribute for the handler:

<configuration>

    <location path="ajaxpro">
        <system.webServer>
            <handlers>
                <add verb="*" path="*.ashx" name="AjaxPro" 
                     type="AjaxPro.AjaxHandlerFactory,AjaxPro.2" />
            </handlers>
        </system.webServer>
    </location>

</configuration>