views:

72

answers:

4

How to make from your Custom HTTP Module a stand aloun TCP\HTTP server capable of for example runing near to any other HTTP server (on same port, just taking some URL namespace like www.example.com/myModule/blabla?id=anyID, and not beeng rood to my other servers like apache HTTP server with PHP (so I can steel call it www.example.com/myApach/blabla?id=anyID) and with my other C\C++ based servers.)?

So I created my module as TCP\HTTP server - I give call URL - it gives me response.

Tooday my ASP.NET server hendels hosting my module.

I want to get rid of that ASP.NET server - make my module stand alone app.

I need CODE examples...)

A: 

Simple answer: you can't. HttpModules are dependent on the ASP.NET framework, which is in turn dependent on the .NET Framework, which in turn requires a separate web server package like IIS or Apache (with lots of reconfiguration).

Adam Maras
We can host WCF services stand alone, why cant we host HTTP modules?
Blender
Because WCF services and `HttpModules` are built on entirely different subarchitectures. They're simply not the same technology.
Adam Maras
A: 

runing near to any other HTTP server (on same port, just taking some URL namespace

That's just not possible. You can't have two different HTTP servers on the same port on the same server. You could have a proxying setup, where one web server receives all the requests and forwards some of them to another web server running on a different port (or even a different server). E.g. you could have Apache handle most of the requests itself and then forward just the requests that are aimed at your web app. Look at mod_proxy, in the "reverse proxy" configuration.

user9876
Dosent windows do it by default? At least for C++ HTTP servers it seems to do such thing... Google HTTP.SYS and read this topic of mine http://stackoverflow.com/questions/2589588/how-to-register-your-application-into-with-http-sys
Blender
And of course we can host infinit number of WCF services on same port... Etc..=)
Blender
A: 

My company makes the "Neokernel Web Server" (http://www.neokernel.com) that lets you host ASP.NET web applications from within your own .NET app without IIS. Look at the "Bootstrapping" demonstration in the "demos/C# Projects" folder for sample source showing how to include the Neokernel assembly with your app and start or stop it from your application code.

Regarding sharing of traffic on port 80, Adam Maras is correct in his answer above - only one app can use a given TCP server port.

Recent versions of windows handle this through http.sys - when you register your various WCF, ASP.NET websites, and handler modules using Microsoft's web.config standards, http.sys will redirect the incoming req (on port 80) to one of the registered handlers (or IIS or another app). This redirection won't happen if you run another app on port 80, and it starts up before http.sys does so it grabs the server socket instead of http.sys

Damien
A: 

I know Windows (and I believe linux as well) only allows you to have one process listening on a specific port. So the best you could hope for is to have a module plug into your other web server to pass on the request. And since you already have to plug in a separate module...

Joel Coehoorn