Application_BeginRequest doesn't fire In Web Service
I created a web service on localhost, and I tried to call it from a web app (also on the localhost) via HttpWebRequest, but Application_BeginRequest in Global.asax didn't fire. When I type in IE 'http://localhost:8010/Test/' (the web service) Application_BeginRequest fires. Where is the problem? How can I test a localhost web serv开发者_运维技巧ice from a page which is also on localhost?
Generally, the best way to test a web service is to write a client to consume it. In particular, you can use a unit test framework to write automated tests of the service.
WCF doesn't even offer the web pages that allow you to test a service, BTW.
Not sure if you have a WCF web service or not, but if you do check out, "WCF Services and ASP.NET". WCF services aren't handled by IIS in the same way as web sites are, which may be the reason BeginRequest doesn't get hit:
The ASP.NET HTTP runtime handles ASP.NET requests but does not participate in the processing of requests destined for WCF services, even though these services are hosted in the same AppDomain as is the ASP.NET content. Instead, the WCF Service Model intercepts messages addressed to WCF services and routes them through the WCF transport/channel stack.
精彩评论