自定义处理程序在Asp.NET开发服务器上工作但在IIS 5.1上没有?

时间:2021-02-25 03:35:02

Hi guys, ive got a stupid problem.

My Custom handler is working 100% on Asp.NET Development server but when i publish the site to IIS 5.1 whenever i try to run Comment/Find (which finds a user via an AJAX call) (i know the naming of my handler sux!!! :)

我的自定义处理程序在Asp.NET开发服务器上100%工作,但是当我尝试运行Comment / Find(通过AJAX调用找到用户)时,我将网站发布到IIS 5.1(我知道我的处理程序sux的命名! !! :)

I get this error:

The page cannot be displayed The page you are looking for cannot be displayed because the page address is incorrect.

页面无法显示由于页面地址不正确,无法显示您要查找的页面。

Please try the following:

请尝试以下方法:

* If you typed the page address in the Address bar, check that it is entered correctly.
* Open the home page and then look for links to the information you want.

HTTP 405 - Resource not allowed Internet Information Services

HTTP 405 - 资源不允许Internet信息服务

Technical Information (for support personnel)

技术信息(支持人员)

* More information:
  Microsoft Support

My code for the AJAX call is:

 function findUser(skip, take) {

        http.open("post", 'Comment/FindUser', true);
        //make a connection to the server ... specifying that you intend to make a GET request
        //to the server. Specifiy the page name and the URL parameters to send
        http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        http.setRequestHeader('Criteria', document.getElementById('SearchCriteria').value);
        http.setRequestHeader("Skip", skip);
        http.setRequestHeader("Take", take);
        http.setRequestHeader("Connection", "close");

        //display loading gif
        document.getElementById('ctl00_ContentPlaceHolder1_DivUsers').innerHTML = 'Loading, Please Wait...<br /><img src="Images/loading.gif" /><br /><br />';

        //assign a handler for the response
        http.onreadystatechange = function() { findUserAction(); };

        //actually send the request to the server
        http.send(null);

}

Please can anyone help me??

请任何人可以帮助我?

3 个解决方案

#1


Make sure you have allowed the extension on the IIS server. The development server does this automatially for you.

确保您已在IIS服务器上允许扩展。开发服务器为您自动执行此操作。

If you open up the properties of the web site then go to the Home Directory Tab and click the configuration button.

如果打开网站的属性,请转到“主目录”选项卡,然后单击配置按钮。

In there try adding the extension you are using for the handler pointing. Set the executable to the aspnet_isapi.dll (look at the standard .aspx extension to find where it is on your computer) and uncheck "Check that file exists".

在那里尝试添加您用于处理程序指向的扩展。将可执行文件设置为aspnet_isapi.dll(查看标准.aspx扩展名以查找它在您的计算机上的位置)并取消选中“检查该文件是否存在”。

I have been burned by this a couple of time and this sorted the problem

我被这几次烧了,这就解决了这个问题

Colin G

#2


On IIS not all calls will be processed by the asp.net handler (unlike cassini the development server) unless the call ends in .aspx, .ashx etc. the .NET isapi dll will not process the call.

在IIS上,并非所有调用都将由asp.net处理程序处理(与开发服务器的cassini不同),除非调用以.aspx,.ashx等结束,.NET isapi dll将不处理该调用。

The clue is in the

线索在

HTTP 405 - Resource not allowed Internet Information Services

HTTP 405 - 资源不允许Internet信息服务

You will need to also map the handler in the web.config if there is not a corresponding .ashx file in the file system.

如果文件系统中没有相应的.ashx文件,则还需要在web.config中映射处理程序。

#3


The problem was that when i was calling the handler on the dev. server i was calling it liek this

问题是当我在dev上调用处理程序时。服务器我叫它谎言这个

http.open("post", 'Comment/Rate', true);

http.open(“post”,“Comment / Rate”,true);

because in my web.config i instructed it to catch all "Comment/" Urls and call the CommentHandler.ashx to handler it.

因为在我的web.config中,我指示它捕获所有“Comment /”Urls并调用CommentHandler.ashx来处理它。

 <add verb="*" path="Comment/*" type="CoffeeMashup2.CommentHandler"/>

However for some reason in IIS it didnt work so i changed the above call to

但是由于某些原因在IIS中它没有用,所以我将上面的调用改为

http.open("post", 'CommentHandler.ashx/Rate', true);

and its worked 100%

并且它100%工作

thanks a lot guys for your help

非常感谢你的帮助

#1


Make sure you have allowed the extension on the IIS server. The development server does this automatially for you.

确保您已在IIS服务器上允许扩展。开发服务器为您自动执行此操作。

If you open up the properties of the web site then go to the Home Directory Tab and click the configuration button.

如果打开网站的属性,请转到“主目录”选项卡,然后单击配置按钮。

In there try adding the extension you are using for the handler pointing. Set the executable to the aspnet_isapi.dll (look at the standard .aspx extension to find where it is on your computer) and uncheck "Check that file exists".

在那里尝试添加您用于处理程序指向的扩展。将可执行文件设置为aspnet_isapi.dll(查看标准.aspx扩展名以查找它在您的计算机上的位置)并取消选中“检查该文件是否存在”。

I have been burned by this a couple of time and this sorted the problem

我被这几次烧了,这就解决了这个问题

Colin G

#2


On IIS not all calls will be processed by the asp.net handler (unlike cassini the development server) unless the call ends in .aspx, .ashx etc. the .NET isapi dll will not process the call.

在IIS上,并非所有调用都将由asp.net处理程序处理(与开发服务器的cassini不同),除非调用以.aspx,.ashx等结束,.NET isapi dll将不处理该调用。

The clue is in the

线索在

HTTP 405 - Resource not allowed Internet Information Services

HTTP 405 - 资源不允许Internet信息服务

You will need to also map the handler in the web.config if there is not a corresponding .ashx file in the file system.

如果文件系统中没有相应的.ashx文件,则还需要在web.config中映射处理程序。

#3


The problem was that when i was calling the handler on the dev. server i was calling it liek this

问题是当我在dev上调用处理程序时。服务器我叫它谎言这个

http.open("post", 'Comment/Rate', true);

http.open(“post”,“Comment / Rate”,true);

because in my web.config i instructed it to catch all "Comment/" Urls and call the CommentHandler.ashx to handler it.

因为在我的web.config中,我指示它捕获所有“Comment /”Urls并调用CommentHandler.ashx来处理它。

 <add verb="*" path="Comment/*" type="CoffeeMashup2.CommentHandler"/>

However for some reason in IIS it didnt work so i changed the above call to

但是由于某些原因在IIS中它没有用,所以我将上面的调用改为

http.open("post", 'CommentHandler.ashx/Rate', true);

and its worked 100%

并且它100%工作

thanks a lot guys for your help

非常感谢你的帮助