I am developing an application which uses the StreamingSubscriptionConnection object in the EWS managed API.
When the network connection is lost for a certain period of time it throws an exception whose StackTrace shows this
System.Collections.Generic.KeyNotFoundException was unhandled
Message=The given key was not present in the dictionary.
Source=mscorlib
StackTrace:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.Exchange.WebServices.Data.StreamingSubscriptionConnection.IssueSubscriptionFailures(GetStreamingEventsResponse gseResponse)
at Microsoft.Exchange.WebServices.Data.StreamingSubscriptionConnection.HandleServiceResponseObject(Object response)
at Microsoft.Exchange.WebServices.Data.HangingServiceRequestBase.ParseResponses(Object state)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
InnerException:
Anyone has any idea why this might be happening?
Thanks in advance.
It seems that your client receives notification for a subscriptons which has already been terminated and removed from the client. The StreamingSubscriptionConnection class maintains an internal list of subscriptions. When it receives a failure event from the server, it notifies the client and removes the subscription from said list. If it receives another failure event for this subscription the exception you are seeing would be created.
To troubleshoot the issue try monitor the traffic returned between your client and the Exchange server with Fiddler (http://www.fiddler2.com/fiddler2/). It acts as a proxy between your application and Exchange and it can decrypt SSL traffic. Perhaps this will give you more insight about what's going on.
Related
I'm using mavlink with a pixhawk flight controller. I receive messages from heartbeat thought I don't know how to receive information about it's altitude, pitch, roll or yaw.
When I connect pixhawk through qgroundcontrol application I immediately connected and can see the direction on compass, yet I don't know how to replicate that. The information I'm specificallly looking for can be received by getting a return from messages: msg_vfr_hud.MAVLINK_MSG_ID_VFR_HUD, msg_ahrs2.MAVLINK_MSG_ID_AHRS2, msg_ahrs3.MAVLINK_MSG_ID_AHRS3.
I tried creating them like that:
msg_ahrs2 msg = new msg_ahrs2();
communicationService.pushMavLinkMessage(msg);
But I don't receive any information back. Do I have to make any preflight configuration?
Any help will be appreciated.
When the connection is established between the flight controller and companion board, the flight controller will automatically start sending telemetry messages (like GPS information ..).
The connection between the flight controller and the companion board is either serial or by socket (TCP/UDP) so you should handle the incoming data correctly and use mavlink_parse_char function to get mavlink packet format.
You can use dronekit (A python API) , Ottofly (C++ API) or you can build your own one to get and send data to flight controller.
Check this example in C for Udp connection.
Created an windows service which saves all received and sent emails to my local drive and my service successfully does that.I have also resubscribed my streaming subscription onDisconnect event and Onerror event also.But my service stops responding after some time and there is no exception catched even though i have handled everything properly.Saw other forum and found the same issue people facing but there is not proper solution.
static private void OnDisconnect(object sender, SubscriptionErrorEventArgs args)
{
try
{
// Cast the sender as a StreamingSubscriptionConnection object.
StreamingSubscriptionConnection connection = (StreamingSubscriptionConnection)sender;
if (!connection.IsOpen)
connection.Open();
}
static void OnError(object sender, SubscriptionErrorEventArgs args)
{
// Cast the sender as a StreamingSubscriptionConnection object.
StreamingSubscriptionConnection connection = (StreamingSubscriptionConnection)sender;
if (!connection.IsOpen)
connection.Open();
}
Is this something to do with the Microsoft bug or it requires any settings on Exchange server for changing the limits for EWS subscription.
Even i checked below something related to throttling limit but no success:
http://msdn.microsoft.com/en-us/library/exchange/hh881884(v=exchg.140).aspx
Thanks a million in advance.
We have exactly same issue. And we do re-create whole subscription in OnError event just in case. It is also interesting that multiple application instances running on separate boxes exhibit identical behavior: at some point they just stop receiving notifications. Restarting any and all of them doesn't help; they do successfully subscribe but still no notifications other than OnDisconnect. Restarting Exchange Server is what really helps, though for a while.
I can see that the problem here is that you are trying to open the connection in the OnError handler. The problem here is that when OnError happen, the connection normally loses all the subscriptions, so you might need to consider creating the subscriptions again before opening them.
I am writing an instant messaging library. Currently, when a SocketException is raised while reading or writing to the socket, I start the logout routine from inside the application, passing the SocketException to the enduser as an argument of the LogoutEventArgs. This gives the end user a way of seeing what underlying exception actually caused the unrequested logout.
My question, is what am I to do, if during a user call to the Logout function, the socket actually throws an Exception.
Example - End user calls Logout function, and while the logout function is waiting for existing requests to end gracefully, the socket throws an exception in the reading thread.
I have two options as I see it -
Pretend the error didn't occur, and just act like the socket disconnected as part of our Logout.
When the socket exception is raised, see if a logout request is taking place, and if so, override it. Resulting in the original Logout request throwing an AlreadyLoggedOutException, as well as a separate logout event which passes the exception in the LogoutEventArgs.
Also, slightly related - What am I to do if the server initiates a shutdown that wasn't requested (ie.. the read call returns null).. the .NET Messenger server has a tendency to do this if you send a request it doesn't like. Do I treat this as an exception in itself?
I have found the whole disconnecting/logging out part of my library to be a major thorn in my side. I just can't seem to wrap my head around it. Does anyone know of any open source code applications that handle this situation beautifully?
I have been trying to tackle this thing in my head for so long, it's driving me mad.
I decided not to pass the SocketException to the end user, as a disconnect is not truly an exception and should be expected and dealt with. Instead there is a LogoutReason property on the LogoutEventArgs which specifies why the logout occured.
I decided that if the disconnect occurs during Logout then that's not actually an exception for, as the logout was going to disconnect anyway. I simply disregard the exception in this case.
I have a "Cron Service" that i've had running on our production server for over a year and a half.
It's a regular windows service which every minute connects to the DB, checks on one table whether there's something to do, and if so, does it. This is a server for a website that's not used a lot, so most of the time the service is completely idle.
A couple months ago, this service started throwing the following exception and dying:
MESSAGE: Object reference not set to an instance of an object.
SOURCE: MySql.Data
TARGETSITE: MySql.Data.MySqlClient.Driver CheckoutConnection()
STACKTRACE: at MySql.Data.MySqlClient.MySqlPool.CheckoutConnection()
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at DBA.Connect() in D:\xxx\DBA.vb:line 21
at CronService.TaskMailings.OnExecute() in D:\xxx\TaskMailings.vb:line 54
at CronService.CronTask.ThreadExecute() in D:\xxx\CronTask.vb:line 99
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
The exception is clearly coming from inside the MySQL Library. Also, my function that calls it is pretty simple:
Public Shared Function Connect() As MySqlConnection
Dim strConnString As String = WebConfigurationManager.AppSettings("ConnectionString")
Dim DBConn As New MySqlConnection(strConnString)
DBConn.Open()
Return DBConn
End Function
And the function where I'm calling DBA.Connect() (CronService.TaskMailings.OnExecute) is doing so with a "Using" statement, so the connection is getting closed, this shouldn't be a problem of connections being left open and getting exhausted (although it might, if there's a bug inside the MySQL library).
This is the connection string I'm using for the Service:
server=localhost;port=13306;uid=xxx;pwd=xxx;database=xxx;Pooling=True;charset=utf8;
Any ideas what might be going on here?
The strangest part is that this has worked for well over a year before it started happening out of the blue, and load to the server hasn't changed enough to justify it being a load problem, I believe.
EDIT: Some of the times it dies, it gives this other error message:
MESSAGE: error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
SOURCE: MySql.Data
TARGETSITE: MySql.Data.MySqlClient.Driver GetConnection()
STACKTRACE: at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
atDBA.Connect() in D:\xxx\DBA.vb:line 21
Although the error message is pretty clear, like I mentioned before, we are releasing all connections, so this shouldn't happen. Any ideas?
I realize this is an old question however the issue lies in the mysql.data.dll
What version was this tested against?
I'm currently seeing this issue in 5.2.2.0 (and it doesn't happen in 5.0.1.0).
I'd suggest either down grading to 5.0.1.0 or upgrading to the latest and seeing if it still occurs.
I have a sequential workflow, which is hosted in IIS as a Workflow Service.
My workflow starts with a ReceiveActivity, and inside the ReceiveActivity a call is made to a WCF service with a SendActivity. If this call receives an exception, there is a FaultHandlerActivity on my ReceiveActivity which is meant to handle the call, and send a default value back to the client.
What is happening in my client is that an exception on the SendActivity is bubbling back to the client as a FaultException, even though my FaultHandlerActivity is running (I verified this by logging the beginning and end of the single CodeActivity in my fault handler)
My question is: How can I swallow exceptions ocurring in the SendActivity, without a FaultException being returned to the client?
OK, I figured it out.
My receiveActivity had a fault handler directly on it. What happens then is that if any child activity raises an exception, the fault handler on the receive activity is invoked, and it is also set to a Faulted state, and the exception received is returned to the client application - whether I wanted that or not.
The solution was to add a sequence activity inside the receiveActivity, do all of the processing inside the sequence activity, and add a faultHandlerActivity to the Sequence, which sets up my default return value.
The receive activity is never faulted, and the exception is not returned to my client, but the default value set up in the Sequence's FaultHandler is returned.
Hopefully this will help someone else with the same issue