简体   繁体   中英

Monitor IIS .NET outbound connections

We have 2 .NET (C#) apps running in an app-pool in IIS (6.0). One app (lets call it APP-A) makes outbound connections to the second app, APP-B. We believe there is a limit to the number of outbound connections APP-A can make to APP-B which can be changed by many settings.

The question is: How can we monitor the number of outbound connections for any .NET app?

I have gone through a few perfmon counters and netstat examples, but everything seems to be dealing with inbound connections or total connections, but nothing that drills down to outbound connections.

Even if you have information that applies to different .NET or different IIS versions, please do post.

IIS depends on HTTP.SYS to do the TCP listening (on port 80 or whatever your site is listening on) on behalf of IIS. That means that the process doing the listening, as far as NETSTAT is concerned is the system process (4). Because of this behavior, in your scenario your actual application pool processes are NOT listening. Therefore NETSTAT should give you the information you want.

1) Identify the application pool you are interested in and find its process ID. You can do this by using Task Manager and find the W3WP.EXE that is running your application pool by matching its identity with your application pool name (IIS 7.5+). Or you could have your application somehow dump out the process ID programmatically. Or your could use NETSH HTTP to identify the process. By whatever means, identify the process ID in question.

2) Run

NETSTAT -A -O | findstr <ProcessId>

This will identify all the connections established/listening for the give process. But since you're almost assuredly not listening in the process itself, you have the list of the outbound connections.

NETSTAT is kind of slow so you may also have success using TCPVIEW (SysInternal tool) to find the connections for the given process.

Hope that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM