Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to find information on how to set up IIS and what a basic "here's the code needed to implement callbacks from IIS". I don't want ASP.NET, MVC, etc...I just want to learn how you use IIS as a web server and hook into whatever it is that IIS calls in one's assembly that let's you hook into requests coming from the browser.

Annoyingly, I can't find any information on how to do this! I've looked at the NancyFx code, and it seems to involve IHttpAsyncHandler, but that's as far as I've gotten.
Posted
Comments
Sergey Alexandrovich Kryukov 22-Jan-15 14:40pm    
Probably you cannot find it just because this is not intended use of IIS. :-)
The documentation on creating on creating of an asynchronous HTTP handler related to IHttpAsyncHandler is also related to ASP.NET (https://msdn.microsoft.com/en-us/library/ms227433%28v=vs.140%29.aspx and more).

IIS just does what it does. You did not explain the goal of your activity, but an apparent way of intercepting of HTTP requests in a custom way (if you consider all existing server-side technologies as non-custom) would be having your own HTTP server, which is not even too hard to do.

—SA

Found this: https://msdn.microsoft.com/en-us/library/vstudio/ms228090%28v=vs.100%29.aspx[^]

and for async, this[^]

but both work with ASP.NET. What confuses me is that I thought IIS was the server, and as Sergey pointed out, I might as well write my own server, which of course I have an article about, but I'm wanting to figure out the minimal approach on using IIS, and without the ASP.NET baggage.

Marc
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 22-Jan-15 15:00pm    
Of course it's about ASP.NET; I already mentioned it in my comment, so this is not an answer to our own question. I think you really should follow my considerations I put in Solution 2; I
think this is really a solution, like it or not.

Short answer is: such mechanism apparently does exist, but it it implemented in the way to reach most important goals of the server, and this way is the HTTP server's modules. So use it or... not.

—SA
Please see my comment to the answer. I believe what you are asking about is reduced to the problem of creating of a custom HTTP handling module. Please see:
https://msdn.microsoft.com/en-us/library/vstudio/ms227673%28v=vs.100%29.aspx[^],
http://www.iis.net/learn/develop/runtime-extensibility/developing-iis-modules-and-handlers-with-the-net-framework[^],
Writing Http Handlers and Modules in IIS 7.5[^].

I don't know if it fits you idea. It might not, if your idea behind was simplicity, if you imagine that there should be more direct and "simple" was than using, say, ASP.NET. But then you should consider the philosophy of an HTTP server. What would you do if you designed an HTTP server code to make it usable? Probably, you would organize handling of Web requests and responses in some basic way. What is that? Apparently, mapping some part of the server host's file system (starting from the root set up for a particular site) directly to HTTP requests and response. You would add some HTTP headers (first of all, "content-type") to the HTTP response using some configurable rules (mostly based on file name pattern) and then, after the headers, the verbatim file content would follow.

What's on top of it? Server-side technologies: routing, URL renames, server-side includes and all those scripting engines. They all are independent enough: they interpret HTTP requests and generated HTTP responses, according to some artifact (resources) stored in the server's host file system, in some ways different from the default described in my previous paragraph. So, they have to be some modules. It would be pointless to provide a separate HTTP hooking mechanism, because such mechanism is already provided by the modular architecture.

So, even if I'm missing something here and such "separate" hooking mechanism does exist, I still provided some rationale for not looking further. :-)

[EDIT]

I did not know that you have an article on HTTP server's creation, but the fact that you have it should make my considerations even more apparent. :-)

—SA
 
Share this answer
 
v2
Comments
Marc Clifton 23-Jan-15 8:51am    
Those links were exactly what I was looking for. The reason I'm interested in this is mostly academic--I want to know how it's done rather than necessarily needing to do it. Thanks very much for finding those links, my google fu was not working very well, I suspect because I wasn't using keywords like "handlers" and "modules".
Sergey Alexandrovich Kryukov 23-Jan-15 11:37am    
Google fu, he-he.
Get good, you are very welcome.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900