.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Getting the number of open sessions to a WCF Net.Tcp service

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :WCF

I am trying to find out the number of open sessions to a service. In the case of a client proxy being used but not closed. In .NET 4.0 I was able to find out the performance counter to do it, it is Max Concurrent Session

But in .NET 3.5 this counter does not exist. We can not move to 4.0 yet, and I was sure there should be a way to do (maybe via another counter) for version 3.5

For a service that is using net.tcp, what can I use to find out the number of open sessions, or the number of refused sessions?

View Complete Post

More Related Resource Links

'Meter number is not registered ' error FedEx ship web service move to production



I want to integrate FedEx ship web service in my website. It works fine for local but for production it gives error. I changed test credentials by production credentials. also changed test url "https://gatewaybeta.fedex.com:443/webservices" by production url "https://gateway.fedex.com:443/webservices" But I am getting error that meter number is not registered. Please advice.

Cash Drawer - Method Open threw an exception - Windows Service

Hi All, I'm getting the following exception while calling Open method of Cash Drawer object. Method Open threw an exception.  Could not read the device name key's default value, or could not convert the Programmatic ID it holds into a valid Class ID. Code:   class Class1 { CashDrawer _uniCashDrawer1 = null; DeviceInfo cashDrawerDevice1 = null; PosExplorer posExplorer = new Microsoft.PointOfService.PosExplorer();   public void ClaimCashDrawer() { cashDrawerDevice1 = posExplorer.GetDevice("CashDrawer", "testDrawer"); if (cashDrawerDevice1 != null) { _uniCashDrawer1 = posExplorer.CreateInstance(cashDrawerDevice1) as CashDrawer; if (_uniCashDrawer1 != null) { _uniCashDrawer1.StatusUpdateEvent += new StatusUpdateEventHandler(UniCashDrawer1_StatusUpdateEvent); _uniCashDrawer1.Open(); _uniCashDrawer1.Claim(0); _uniCashDrawer1.DeviceEnabled = true; } } } }   Tha above code works fine if you put the code in WindowsApplication in all POS systems. The same is working if you put the code in Windows Service in all other POS systems. The same is not working if you put the code in Windows Service in Aures Galeo POS systems.  Thanks in advance. Ramakrishnan S

OPEN SYMMETRIC KEY - Persist Across Sessions

We have a client .NET WPF application which connects to a local SQL 2008 Express server.  We are using symmetric SQL encryption to encrypt some columns.  In order to encrypt or decrypt, we must first open the symmetric key.  We have a logon trigger which opens the key automatically for us. Unfortunately, the key is opened A LOT due to the key being closed after each session closes.  This causes the CPU to peg at 100%.  We are using connection pooling and it would be wonderful to have the key remain open across sessions.  Anyone have any thoughts on how to do this?

To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the s

The following error is issued following 10 minutes of system inactivity: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. ---> System.ServiceModel.FaultException: The message could not be processed. This is most likely because the action 'http://tempuri.org/IParticipant/SearchParticipants' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding. Per the message, I tried changing the app config on the client from     receiveTimeout     ="00:10:00" to     receiveTimeout="10:00:00" but the change seems to have no impact.  What am I missing?

Analysis Service Oracle Number inconsistent Data Type for TABLE or Named Query

Dear Gurus, I'd VERY OLD PROBLEM. And I believe it addressed since 2006. When I design DataSource Views from Oracle Data Source. I found it return different oracle number data type for TABLE or NAMED QUERY   Provider Data Type Column Data Type Data Source View Data Type Oracle OLE DB Provider (OraOLEDB.Oracle.1) Table Number System.Int64   View Number System.Decimal   Named Querey Number System.Decimal Microsoft OLE DB Provider for Oracle (MSDAORA.1) Table Number System.Double   View Number System.Double   Named Query   1 System.Int64   Named Query   1.1234 System.Int64 Althought I know I can fix IT via MANUALLY EDIT DATASOURCE VIEW XML SOURCE. But I don't think this is a better solution. Is anybody have ideas ?  Wilson

Problem: Sessions got mixed up when open multiple tab for a sigle application

We got a problem that Sessions got mixed up when open multiple tab in a single application. We could change the code that do not use session variable in a that level, but a tons of page need to be modified. We need to find a quick fix for this problem. Is any thing we can do in code level to prevent user open multiple tab in a single application? O any thing we can do to keep its own session for a single tab?

Database Service number does not change

I notice when I check to make sure the SP3 took I still see SQLExpress\9.0.3042 instead of 9.0.4035 for SP 3. The server management studio changed has to 9.0.4035 but not the database. Can some explain this?

Send/open timeouts on WAS-hosted WCF service with named pipe orTCP binding, per-call instancing

We have a client that sends requests to a per-call WCF service (WAS hosted, NP binding, same machine) in a loop. The WCF service calls an external EXE to process requests. The operations on the service can take a few seconds, or a few hours. To combat this, we have sendTimeout=00:05:00, receiveTimeout=00:05:00 and a built-in circuit-breaker on the service that kills the external process after 00:05:00. Any service-side errors are returned to the client as FaultExceptions.  On the client, FaultExceptions are logged and the client proxy is aborted (proxy.Abort()). The client has configurable multithreading. In this example, it is running 3 threads, each of which creates a proxy, makes a call, and closes the proxy (or aborts it if an exception was received). Since the service is instanced as per-call, and it never receives more than 3 simultaneous calls (each of which being followed by a .Close() or .Abort() on the proxy), I would not expect the client to be getting timeouts during the send, but I am. In fact, the send timeouts I am receiving would seem to imply that the WCF service is hitting the default session limit, even though the class is explicitly marked with [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]. I put some trace logging on the client and I can see that the timeout is occurring when the proxy is being created. sendTimeout seems to

Counting the number of sessions in a web farm



We have a ASP .NET application which will be deployed in a web farm. We would like to find the total number of sessions that have been established. If we create a counter in global.asax.cs, it will be able to count only within aspnet_wp process. In a web farm, multiple nodes will have IIS on multiple machines.
If we use SQL server-based session management, can we get the total number of active session by querying the Session DB?
If we later decide to use session state server to store the sessions, can we get the number of active sessions?


2008 R2 Web Service URL - just shows empty page and SQL version number


In SQL Server 2008 R2 I installed reporting services.


When I go into the Reporting Services Configuration Manger and then Web Service URL and click the hyperlink it just goes to an empty looking page.


localhost/ReportServer - /


Microsoft SQL Server Reporting Services Version 10.50.1600.1 

The Report Manager URL works fine.

I have uninstalled and re-install Reporting Services two times now and changed the URL address several times too.  Still it's always stuck on this page.

Any ideas?


NHibernate - Illegal attempt to associate a collection with two open sessions


These are my tables:
Users -
UserId, StateId, CityId (StateId > States.StateId, CityId > Cities.CityId)

States -
StateId, StateName

Cities -
CityId, StateId, CityName (StateId > States.StateId)

UsersRepo rUser = new UserRepo();
rUser.State = rStateRepo.Load<State>(1);
rUser.City = rCityRepo.Load<City>(1);

This does not work, am i using sessions in wrong way.???

Why does SqlConnection open when SQL Service is stopped?



I'm writing some C# code to diagnose whether SQL Server is unavailable or if the entire server is unavailable. My approach is to first check if I can open a connection to the SQL Server using a SqlConnection. If it does not open successfully, I ping the server to check for general connectivity. The problem is, even if I stop my SQL Server (Express) service to simulate a problem with the database, my connection still opens and closes without an error. I don't want to execute a SQL statement because that could fail for other reasons and I might not have the rights needed to actually check whether the service is running using a C# service controller. How does the connection open if the service isn't running?

SerialPort.Open Insufficient system resource exist to complet the requested service



SerialPort.Open call in my application crashes intermittently on only one laptop of all machines with the following exception.

Error. Insufficient system resources exist to complete the requested service.

at System.IO.InternalResources.WinIOError(Int32 errorCode,...)

at System.IO.PortsSerialStream..ctor(String portName,...)

at System.IO.Ports.SerialPort.Open()


I am clueless how to debug into this issue, as this happens only on one of the laptops and that too intermittently.

I doubt it is a corrupt kernel issue or ??!!!

Can anyone point me to a direction that can help me resolve this issue or reveal a hidden bug.




Using .NET (C#) windows service to interact with Windows user sessions

Hey all.

I have an issue and do not exactly know the best way to solve it.

I have a windows service that will be running in the background, using WCF to receive requests to update software I will have installed on each machine. As part of the update, it will need to close windows services, which is fine. But I also need to close down any applications that are running that I wish to update. Also I will need to let a user know (if someone is logged on) that something is happening.

Basically, how do I see who is logged on, and then from my windows service, close down possible running applications on the users session, and display a front end gui screen that I will be creating as a WPF form.

I've read that there are certain things like using netapi32.dll with NetWkstaUserEnum, to possibly get user names, and things like WTSEnumerateSessions. Although I am not 100% sure which if any of these I should/need to use.

Thanks, Paul.


Not able to open WCF Web Service through browser


Hello everybody,

  I am developing a windows mobile application. I am using SQL CE edition 3.5 SP1 on my mobile and SQL server 2008 on my machine. I am using WCF project to sync my server and mobile application. I am using Microsoft Sync Framework for this.

I have added Local Database Cache and generated the web service. I am able to add the web reference to my client project (mobile application). But I am not able to open the web service on any browser.

I am using the URL like "http://<ComputerName>/ServiceName/" . When i type this url on my browser it says web page not found. I am able to host the service using WCFSvcHost. But still not able to open that service using browser. Can someone please let me know what I am missing over here.


Windows Service Applications Tutorials

You can easily create services by creating an application that is installed as a service. For example, suppose you want to monitor performance counter data and react to threshold values. You could write a Windows Service application that listens to the performance counter data, deploy the application, and begin collecting and analyzing data.

How To Open Fancy Tooltip from GridView

This article will show How To Open show Fancy Tooltip in GridView.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend