WCF without HTTP.SYS

北慕城南 提交于 2019-12-03 02:38:06

WCF HTTP based bindings are dependent on HttpListener class which is managed wrapper around HTTP API. HTTP API is dependent on the way how operation system process http requests. So if you use operation system which uses http.sys driver (Windows 2003 and newer) you are dependent on it.

Edit:

Based on very good argument about Cassini I spent two hours in Reflector. Following description is only my assumption. I haven't found any information about it so maybe I'm completely wrong.

WCF internally contains some abstract class called HttpTransportManager this class is derived by internal classes HostedHttpTransportManager and SharedHttpTransportManager (this one also exists in version for HTTPS). The former one is not dependent on HttpListener but the latter one is. The former one is used when WCF is hosted in ASP.NET pipeline - internal classes HttpModule and HttpHandler from System.ServiceModel.Activation assembly use HostedHttpRequestAsyncResult dependent on HostedHttpTransportManager. The later one is used when HttpChannelListener is created (self-hosting).

My conclusion is that WCF service hosted in ASP.NET pipeline is not directly dependent on http.sys but the IIS hosting the pipeline is. This allows creating custom web server which will not be dependent on http.sys but will be able to host ASP.NET and so WCF. I think this is what Cassini does. Self hosted WCF service is always dependent on http.sys.

As I written above this is only my guessing based on some quick reverse engineering.

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