私は http ハドラーを使用しようとしているので、クラス ライブラリー プロジェクトを作成し、次のコードを追加しました。
namespace MyProject.Handlers
{
public class Class1 : IHttpHandler
{
public bool IsReusable
{
get { return false; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.Write("Hello from custom handler.");
}
}
}
次に、それをコンパイルすると、MyProject.Handlers.dll ファイルが生成されました。それをasp.netのbinフォルダーに入れて、これをasp.netに追加しました
<system.webServer>
<handlers>
<add name="TutorialHandler" verb="*" path="*" type="MyProject.Handlers.Class1, MyProject.Handlers" modules="IsapiModule" scriptProcessor="c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="File" />
</handlers>
<modules runAllManagedModulesForAllRequests="true">
//some stuff I *think* it doesn't make a difference
</modules>
//some stuff I *think* it doesn't make a difference
</system.webServer>
と
<system.web>
<httpHandlers>
<add verb="*" path="*" type="MyProject.Handlers.Class1, MyProject.Handlers" />
</httpHandlers>
</system.web>
しかし、それは呼び出されません!デバッガーを起動し、ブレークポイントを設定しましたが、停止しません。firebug で出力 html を確認すると、「Hello from custom handler」という文がありません。
私は何を間違っていますか?
ありがとう、オスカー
編集: フレームワーク 4.0、IIS7 を使用しています。ルートを使用している可能性がありますか?(index.aspx を直接呼び出すのではなく、/home などを呼び出すのですか?)