tags:

views:

241

answers:

3

Is there any way to call functions in a httpmodule from an asp.net application, even if the httpmodule is in another process? Better yet, in a situation where the application pool is running as a web garden (>1 worker process) how can I communicate with all of the httpmodules that are running?

A: 

In order to communicate between the web garden processes you'll have to use something like .Net remoting or the new WCF (as casperOne pointed out).

David
@David: While Remoting isn't dead, WCF is usually the much better choice now.
casperOne
+2  A: 

You shouldn't count on one instance of the HttpModule to run and then have all other instances connect to that.

Rather, it sounds like you should develop a service which does the work that you want (or some other shared programmatic resource, perhaps a singleton in COM+?) and then have your HttpModules communicate with the service using some sort of distributed communication technology (I'd recommend WCF, a named pipe channel).

casperOne
A: 

I've done this sort of thing in two ways. 1) using remoting to set up a web service to allow such calls, and 2) using making manual web requests from one host to the namespace of another.

If your request can work as simple querystring, and the results are ok as html/xml, this second approach is a lot simpler (and much less overhead) than actually setting up full web services. You already have a request-response architecture in place given that this, in fact, a webserver, so it makes sense to use that, I think. If security is a concern, you can make these secondary pages that you are calling only give responses to requests from localhost/127.0.0.1.

x4000