C# ASP.NET HTTP处理程序无法识别的请求
我有ASP.NET处理程序。但当我试着给它打电话时,它说: 您正在查找的资源已被删除、名称已更改或暂时不可用C# ASP.NET HTTP处理程序无法识别的请求,c#,asp.net,handler,httphandler,C#,Asp.net,Handler,Httphandler,我有ASP.NET处理程序。但当我试着给它打电话时,它说: 您正在查找的资源已被删除、名称已更改或暂时不可用 namespace SimpleHTTPHanlder { public class SimpleHandler : IHttpHandler { #region IHttpHandler Members bool IHttpHandler.IsReusable { get { return tru
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>
看看我们有效的代码,一些想法:
- 尝试在
下添加处理程序,而不是system.webServer
system.web
- 尝试添加属性
predition=“integratedMode”
- 尝试指定
属性名称
它是带有打字错误的复制/粘贴吗?(汉德尔)我认为正如你所写的那样
http://localhost:60223/SimpleHTTPHanlder/vishal.nayan.
而不是这个尝试
http://localhost:60223/vishal.nayan
这是因为您的path元素只包含vishal.nayan
<httpHandlers>
<add verb="*" path="vishal.nayan" type="SimpleHTTPHanlder.SimpleHandler"/>
</httpHandlers>
如果您仍然有问题,请告诉我您是否在IIS或IIS express上托管过
如果您已在IIS中配置(IIS 7或7.5更高版本),则必须在中配置
<system.webServer>
<handlers>
<add name="test" verb="*" path="vishal.nayan" type="SimpleHTTPHanlder.SimpleHandler"/>
</handlers>
...... other configuration
</system.webServer>
……其他配置
<httpHandlers>
<add verb="*" path="vishal.nayan" type="SimpleHTTPHanlder.SimpleHandler"/>
</httpHandlers>
<system.webServer>
<handlers>
<add name="test" verb="*" path="vishal.nayan" type="SimpleHTTPHanlder.SimpleHandler"/>
</handlers>
...... other configuration
</system.webServer>