How can i programmatically find out how many resources a IIS server has and the traffic on each resource .. etc
I 开发者_StackOverflow中文版want to write a program to find out what resources an IIS server has and how many hits are there on each resource. The resource can be anything from a html page to files like sound clips, pictures , etc. I want to find out a list of all these resources and then i got to calculate the traffic as well. So can this be done without using any existing tool. I am not allowing myself to use any tools. I looked into WMI classes, but they do not give very detailed data like i want. I also thought about using ISAPI Filters to log each request. But i am finding it very difficult to learn. So is that a good way to go ? or shall i look at some thing else ?
It would be easiest to just analyze the server's access logs, but if you want to write code, an ISAPI filter would certainly do it. There are samples in the SDK. An ISAPI extension, installed as a wildcard script-map, would also work. If you use a filter, you should probably only register for preproc_headers. Some of the notifications have a significant performance penalty, even if you do very little inside them, since they re-route the request path inside IIS. (Thinking specifically of send_raw_data here.)
精彩评论