Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have an employee, and he uses a cloud VPS to connect to our system to do his job. What a Cloud VPS is, is a "virtual private server" from one o those providers where you get servers you can create/destroy at whim and then, once created, a server is accessible with Remote Desktop Connection.

We are getting this really strange error, and I really don't see a way to fix the error or prevent it from happening. It seems to happen at Microsoft's whim, just whenever it feels like it. Doing a soft reboot of the server VM from the cloud control panel website seems to fix the error, at least temporarily, until the error "feels like it wants to happen again."

The error is shown in the following image:

Error Image [^]

Once the error occurs, my employee is thrown off of the system. The employee is also not able to reconnect until someone has actually gone ahead and soft-rebooted the machine (unless someone out there knows a less resource-intensive/time-intensive way of fixing the issue). However, as it stands currently, no one else at our company gets the notification until several hours later, meaning the employee is not productive and we lose money.

I want to workaround this some how. What I would like to do is to write a C# program to install on the server, that will detect when this error condition has occurred, specifically, from the server's point of view, and then issue a soft reboot.

Anyone have any ideas on how to programmatically detecting this error?

Brian Hart

What I have tried:

I have Googled and searched. I have thought of the following:

Monitoring the event log.
My employee has told me the date/time down to the minute of when this error occurred, and there is a database table that is updated every time the employee does something, and it says that the last action occurred on the system at 12:52:28 PM of 3/30/2017. So okay, I go into the event log of the computer and look for any Error events at that time. I looked in the System, Setup, Windows, and Application logs. In addition, I also looked under the logs for the Remote Desktop Connection specifically. Nada.

Attaching the SystemEvents.SessionSwitch event.
I saw a post on StackOverflow about this. This, in principle, would work, to handle this event and to test on the e.Reason being some particular value that indicates the remote session was disconnected. However, this is a little too generic for the purposes described above, as this would mean, in principle, that a soft reboot would be done every single time the employee even just clicks the "X" button on the RDP window. That would not be appropriate for our application.

The above are two major things that come to mind as being able to assist me in writing a C# program to address this issue (either by notifying our IT department when the specific error occurs, or like I said, automatically soft-rebooting the machine).

However, for the reasons above, the two potential solutions above have issues that would seem to prevent an effective solution from being written. I have google searched and google searched, and will continue to do so, but I am open to any suggestions.
Posted
Updated 31-Mar-17 11:19am
v3

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