当我添加HTTP处理程序时:
<add verb="*" path="*test.aspx" type="Handler"/>
Run Code Online (Sandbox Code Playgroud)
上课:
using System;
using System.Web;
public class Handler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
}
public bool IsReusable
{
get { return false; }
}
}
Run Code Online (Sandbox Code Playgroud)
我的ASP.NET应用程序因错误"无法加载类型'处理程序'而死亡." 当我尝试访问http:// localhost:port/mysite/this-is-a-test.aspx时.
我想也许这是一个命名空间问题,所以我尝试了下面的内容,但得到了相同的"无法加载类型'Test.Handler'." 错误.
<add verb="*" path="*test.aspx" type="Test.Handler, Test"/>
Run Code Online (Sandbox Code Playgroud)
上课:
using System;
using System.Web;
namespace Test
{
public class Handler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
}
public bool IsReusable
{
get …Run Code Online (Sandbox Code Playgroud)