[英]ASP.NET HTTP Handler Unrecognized Request
I have ASP.NET handler. 我有ASP.NET处理程序。 But when I try to call it it says :
但是当我尝试称它为:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable . 您要查找的资源已被删除,名称已更改或暂时不可用 。
namespace SimpleHTTPHanlder
{
public class SimpleHandler : IHttpHandler
{
#region IHttpHandler Members
bool IHttpHandler.IsReusable
{
get { return true; }
}
void IHttpHandler.ProcessRequest(HttpContext context)
{
HttpResponse response = context.Response;
response.Write("<html><body><h1>Wow.. We created our first handler");
response.Write("</h1></body></html>");
}
#endregion
}
}
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpHandlers>
<add verb="*" path="vishal.nayan" type="SimpleHTTPHanlder.SimpleHandler"/>
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
I try to make request like this, but with unsuccess: 我尝试发出这样的请求,但未成功:
http://localhost:60223/SimpleHTTPHanlder/vishal.nayan
Looking at our code which works, some ideas: 查看我们有效的代码,一些想法:
system.webServer
instead of system.web
system.webServer
而不是system.web
下添加处理程序 preCondition="integratedMode"
preCondition="integratedMode"
name
attribute name
属性 I think as you have written your path as 我认为,正如您所写的那样,
http://localhost:60223/SimpleHTTPHanlder/vishal.nayan.
Instead of this try 代替这个尝试
http://localhost:60223/vishal.nayan
This is because your path element contain vishal.nayan only. 这是因为您的路径元素仅包含vishal.nayan。
<httpHandlers>
<add verb="*" path="vishal.nayan" type="SimpleHTTPHanlder.SimpleHandler"/>
</httpHandlers>
if you still have issue then tell me does you have hosted on IIS or IIS express ? 如果仍然有问题,请告诉我您是否托管在IIS或IIS Express上?
If you have configured in IIS ( IIS 7 or 7.5 later then you have to configure in 如果您已在IIS中配置(IIS 7或7.5之后,则必须在
<system.webServer>
<handlers>
<add name="test" verb="*" path="vishal.nayan" type="SimpleHTTPHanlder.SimpleHandler"/>
</handlers>
...... other configuration
</system.webServer>
http://localhost:60223/SimpleHTTPHanlder/vishal.nayan
is it a copy/paste with a typo ? 它是带有错字的副本/粘贴内容吗? ( Hanlder )
(汉德)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.