开发者

How to make from your Custom HTTP Module a stand alone HTTP server?

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 P开发者_如何学运维HP (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...)


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).


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.


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


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜