How to register your application into\with Http.sys?

坚强是说给别人听的谎言 提交于 2019-12-04 14:34:47

问题


So I created a TCP\HTTP server (IN C#). I want to give to it namespace on my 80's port near to other HTTP servers I have. How to do such thing (step - by step)?


回答1:


Look at HTTP Server Tasks in MSDN spec:

  • Initialize HTTP service API, call HttpInitialize
  • Register URLs with HTTP.SYS, call HttpAddUrlToUrlGroup
  • Receive a request, call HttpReceiveHttpRequest
  • Send a response, call HttpSendHttpResponse
  • Cleanup after urself, call HttpRemoveUrl and HttpTerminate

There is a also a fully fledged application sample at HTTP Server Sample Application.

As you can clearly see, HTTP.SYS API is a C API intended for C applications. You shouldn't be using it from C#, and I'd recommend against pInvoking the entire API. Managed applications have the alternative of using HTTP modules and extend the ASP.Net processing. This avenue will take care of many details needed in a managed server, like activation, hosting, process monitoring and recycling and so on and so forth.




回答2:


The way you would normally interact with http.sys is by registering an ISAPI DLL with IIS. This is a good starting-point.



来源:https://stackoverflow.com/questions/2589588/how-to-register-your-application-into-with-http-sys

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!