简体   繁体   English

什么时候不能调用Application_EndRequest?

[英]When might Application_EndRequest not be called?

We have an ASMX web service hosted in IIS 6, and are seeing some strange behaviour with one of our WebMethod s. 我们在IIS 6中托管了一个ASMX Web服务,并且看到了一些WebMethod的奇怪行为。 After an iisreset , the first call to a particular method fails to return to the client, which times out after 60 seconds. iisreset ,对特定方法的第一次调用无法返回到客户端,该客户端在60秒后超时。

I've introduced logging into Application_BeginRequest and Application_EndRequest in the Global.asax.cs file. 我已经在Global.asax.cs文件中引入了Application_BeginRequestApplication_EndRequest The logging shows that for that one call, EndRequest is not called. 日志记录显示,对于那一个调用,不会调用EndRequest。 A try-finally block in the method itself shows that it is running to completion. 方法本身中的try-finally块表明它正在运行完成。

There are other requests to different methods before, during and after this one that show no problems. 在此之前,期间和之后对其他方法有其他请求,表明没有问题。 TcpTrace shows that no reply is ever returned for that first request to the method. TcpTrace显示对该方法的第一个请求没有返回任何回复。

The logs also show that the thread that serviced the request starts serving other requests after the finally block has completed. 日志还显示,在finally块完成后,为请求提供服务的线程开始提供其他请求。

I'm wondering what might cause such behaviour, and how I might debug this further. 我想知道可能导致这种行为的原因,以及我如何进一步调试它。

Assuming this is entirely repeatable, I would start by changing the method. 假设这是完全可重复的,我将从更改方法开始。 Namely I would remove stuff until it works as expected. 即我会删除东西,直到它按预期工作。

It sounds like there is some odd secondary behavior caused by the web method itself. 听起来有一些由Web方法本身引起的奇怪的次要行为。 I'm guessing it's a bit more complex than just adding two numbers together and returning a result. 我猜这比仅仅添加两个数字并返回结果要复杂一些。

Also I'd pay close attention to what the method is doing. 此外,我会密切关注该方法的作用。 For example, is it instantiating unmanaged resources? 例如,它是否实例化非托管资源? Do you have any http handlers or modules involved which might be cratering on the first execution for this method? 您是否涉及任何http处理程序或模块,这可能会在第一次执行此方法时出现问题?

By eliminating code until it works you'll figure out exactly what's causing this. 通过消除代码直到它工作,你将弄清楚究竟是什么导致了这一点。

some recommendations: put your logging under: Application_AuthenticateRequest Application_Error and see if you are getting any error. 一些建议:将您的日志记录置于:Application_AuthenticateRequest Application_Error,看看您是否收到任何错误。

If this cannot help, check your Application Domain's and IIS's event logs 如果这无济于事,请检查Application Domain和IIS的事件日志

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在什么情况下调用Application_EndRequest但是没有调用Application_BeginRequest? - In what situation Application_EndRequest is called but Application_BeginRequest is not called? 在application_endrequest上部署对象上下文 - disposing object context on application_endrequest mvc3调用不带Application_BeginRequest()的Application_EndRequest - mvc3 invokes Application_EndRequest without Application_BeginRequest() 如何在Application_EndRequest中获取RouteData - How do I get RouteData in Application_EndRequest WCF服务方法是否具有与ASP.NET Application_EndRequest等效的功能? - Does WCF service method have something equivalent to ASP.NET Application_EndRequest? 什么是Java Tomcat中的Application_EndRequest(ASP.NET)等价物? - What would be the equivalent of Application_EndRequest (ASP.NET) in Java Tomcat? 为什么在调用commit函数时SqlTransaction无法提交? - Why might a SqlTransaction fail to commit when the commit function is called? 服务调用应用程序时的不同行为 - Different behaviour when an application is called by a service 当doWork调用时BackgroundWorker崩溃应用程序 - BackgroundWorker Crashes application when doWork called 在IIS中回收应用程序池时,是否调用Application_End? - When an application pool is recycled in IIS, is the Application_End called?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM