Last post Nov 21, 2014 02:25 AM by LemonStreet
Nov 20, 2014 12:06 PM|jwaz1999|LINK
I'm testing a failed SQL connection on my WCF service using the aync version of the open() sql connection (openAsync()), and it hits the exception once if the connection fails on the WCF test client. However on the server the exception runs at least 60
times for the same failed openAsync call. (I'm getting an email every time the exception is hit and I'm getting 60 emails when it runs on the server)
Anyone know the reason behind the difference in numbers of times the exception runs from the test client to the server?
Thanks in advance.
Nov 20, 2014 01:11 PM|PatriceSc|LINK
What you are testing is not crystal clear. What is the mechanism that sends those emails when an exception happens. It sounds like you just have a retry mechanism on the server side (so you do have mutliple exceptions) and that ultimately it is exposed to
the client once the server gave up (so you have a single exception ie the last one that happened).
Knowing what you are doing exactly when an exception happens would likely help.
Nov 20, 2014 01:33 PM|jwaz1999|LINK
I'm sending an email on exception. I have no retry mechanism. It's running the exception code multiple times. Like I said it works as expected from the WCF test client, but runs multiple times (60) on the server.
Here's the code snippet:
using (var dbConnection = new SqlConnection(_connectionString))
var cts = new CancellationTokenSource();
await InsertServiceLoggingToDb(dbConnection, keyword, methodCalled, notes);
catch (Exception ex)
ConfigurationManager.AppSettings["ErrorSubject"], "The following error has occurred in the application: " +
if (dbConnection.State == ConnectionState.Open)
Nov 21, 2014 02:25 AM|LemonStreet|LINK
If the Wcf service Called once but runs multiple times, you could refer to the following links: