[英]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_BeginRequest
和Application_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.