I'm not sure if title sounds right actually, so I will give more explanation here. I will begin from very beginning :)
I'm using c# and .net for my development.
I have an application that makes requests to some soap web-service and for each user request it produces 3 to 10 requests for web-service, they should all run async to finish in one time, so I use Async method of the web-service generated reference and then wait for result on callback. But it seems like it starts a thread (or takes it from pool) for every async call I make, so if I have 10 clients I got to spawn 30 to 100 threads and it sounds terrible even for my 16 cores server :) So i wanted to replace low level transport implementation with my own which uses non-blocking sockets and can handle at least 50 sockets run parallel in one thread with not much overhead. But I actually dunno where to put my override best.
I analyzed System.Web.Services.Protocols.SoapHttpClientProtocol
class and see that it has some Get开发者_运维技巧WebRequest method which I actually could use. If only I could somehow interupt the object it creates and get a http request with all headers and body from there and then send it with my own sockets..
Any ideas what approach to use? Or maybe there's something built in the framework I can use?
Have you considered using .NET WCF instead of .NET 2.0 webservices? There is much more flexibility in terms of transport options with .NET WCF than with .NET 2.0 web services. It has a steper learning curve, but its well worth it. For more details on the transport options check WCF Transport Options In MSN channel 9 you can find some good tutorial videos.
精彩评论