AjaxPro 在本地工作,但在服务器上我收到 .ashx 错误

发布于 2024-07-13 13:39:06 字数 1600 浏览 7 评论 0原文

在本地,我的应用程序使用 ajaxpro 工作正常,但在服务器上我似乎无法弄清楚为什么它不起作用。

使用 firebug 我有以下错误:

GET prototype.ashx 404 not found 获取 core.ashx 404 未找到 GET ms.ashx 404 not found

相同的代码在本地工作,所以它一定是 IIS7 设置?

编辑,我的 web.config

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

也有:

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

和:

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

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

年少掌心 2024-07-20 13:39:06

为了使 AjaxPro.dll 在 IIS7 中工作,您应该将应用程序池的 PipelinMode 设置为 Classical 而不是 Integrated。

我曾尝试到处寻找这个,但最终这救了我。

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.

少女情怀诗 2024-07-20 13:39:06

要在 IIS7(即 Windows Vista)上以集成模式而不是经典模式运行 Ajax.NET,您必须检查两件事:

  1. 首先检查 IIS_ISSRS 组是否有权访问您的网站文件夹。 如果您使用 Visual Studio .NET 2005 网站的默认文件夹,最简单的方法是在 C:\Users\Username\Documents\Visual Studio 2005\WebSites 处添加读取访问权限。
  2. 运行以下命令自动迁移您的 web.config 文件:
    %windir%\system32\inetsrv\Appcmd migrate config ""

Ajax.NET Professional 的重大更改是您必须将 httpHandler(以及 httpModule,如果使用)移动到新部分 system.webServer 并将 httpHandler 重命名为 handler; 接下来,您必须为处理程序添加名称属性:

<configuration>

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

</configuration>

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>
陪我终i 2024-07-20 13:39:06

您确定已在 web.config 文件中正确注册了处理程序吗?

您的 web.config 文件中应该有如下所示的内容。

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

您还需要在 Bin 目录中包含 AjaxPro dll(至少对于网站而言)。

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).

祁梦 2024-07-20 13:39:06

我已经对这个问题绞尽脑汁了几个小时,我想我可能刚刚找到了解决方案......而且它相当,呃......令人沮丧。

在 web.config、system.webServer/handlers 中,可能有多个项目处理 *.ashx

,例如:

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

如果 ajaxpro 条目位于这些条目之下,则不会使用它,因为这些条目匹配第一的。
ajaxpro 条目移至其他条目上方可能会解决该问题。

我不知道为什么卡西尼不介意,但 IIS7 介意......

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...

指尖凝香 2024-07-20 13:39:06
<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 默认情况下没有为使用 Ajax 设置 axd 处理程序映射,因此如果您想使用 Ajax 并且使用我们的 Windows 2008 托管计划之一,则需要将以下代码放入 web.config 文件中。

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

或者将 .dll 复制到 bin 文件夹并尝试:

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

</httpHandlers> in <system.web>
<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>
又爬满兰若 2024-07-20 13:39:06

我只是遇到了同样的错误,但原因可能与您不同。 我在一个新网站(本地运行)上得到了它,因为该网站使用了不排除 .ashx 的自定义 url 重写模块!

所以我的解决方案是确保重写模块排除带有 .ashx 的路径...

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...

时常饿 2024-07-20 13:39:06

将我的 webform 迁移到 MVC 4 后,我得到了这个错误( ajaxpro/core.ashx 404 not found)

我解决了这个问题,将这一行添加到我的 app_start/routeconfig

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

我的 web.config 不需要额外的声明,但是这个

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

,当然还有一个引用放在我的 bin 文件夹中的 ajaxpro.2.dll

希望这有用!

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 !

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文