Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 应用程序_BeginRequest事件未触发_C#_Asp.net_Global Asax - Fatal编程技术网

C# 应用程序_BeginRequest事件未触发

C# 应用程序_BeginRequest事件未触发,c#,asp.net,global-asax,C#,Asp.net,Global Asax,我正在处理应用程序_BeginRequest事件,该事件应该在请求某个url时触发 protected void Application_BeginRequest(Object sender, EventArgs e) { if (HttpContext.Current.Request.Url.ToString() == DummyPageUrl) { RegisterCacheEntry();

我正在处理应用程序_BeginRequest事件,该事件应该在请求某个url时触发

protected void Application_BeginRequest(Object sender, EventArgs e)
    {            
        if (HttpContext.Current.Request.Url.ToString() == DummyPageUrl)
        {
            RegisterCacheEntry();
        }
    }
下面是我用来请求url的代码:

private void HitPage()
    {
        WebClient client = new WebClient();
        client.DownloadData(DummyPageUrl);            
    }
但应用程序_BeginRequest事件未触发。 我也在web.config中尝试过这一点:

<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>


这没用。请帮帮我。

你在global.asax工作吗

在Global.asax页面中尝试此操作

 void Application_BeginRequest(object sender, EventArgs e)
    {



    }

您对IIS应用程序池使用的是经典管道还是集成管道?