简体   繁体   中英

SQL profiling of IIS-hosted WCF application

we have developed a multi user n-tier WCF application where the middle tier is hosted in IIS. Application pool identity is set to a predefined (single) user. Now, all the sql connections in SQL Server Profiler look the same - we don't know how to set filter in a trace for a single client (to see what is going on in the database when I click something in my instance of the client).

Currently, we kind of misused the Application Name field of the Connection String and set it to the, let's say, current user ID. Now, we can filter out only SQL calls from that user. But, as far as I know, ADO.NET connection pooling is based on connection string. So, connection pool is created for each user because, technically, every user has its own Connection String (only Application Name field is different, but it doesn't matter). This could lead to performance issues when a large number of users concurrently access the service and database.

Is there any simple way of SQL profiling for only single client? Can it be set to the connection programatically and then filtered out by using SQL Server Profiler?

Thank you in advance.

OK, I did the following. Still using Application Name of the connection string, but conditionally - I created a SqlDebug app setting and if true, only then I append the user specific information to the conn string (;Application Name=IdUser) and filter out only current user's queries in Profiler. This way, in "normal" conditions, connection pooling works as intended.

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