Handling SQL Exceptions RRS feed

  • Question

  • Hi All,

    I am using CompositeOperation to do multiple inserts with SQL binding.

    In the event of any failure or error in insert/store procedure call, can anyone suggest on how to catch the SQL exception.

    Though I used System.Exception, the error is writing in eventlog, not going to the catch block.

    Please suggest??

    Thanks & Regards, Sridhar

    Friday, February 16, 2018 12:54 PM

All replies

  • What exception you get in the event log??

    Do you mean that the instance of Orchestration instance gets suspended?

    Is the port used to send the sql messages one way? enable delivery notification on the port to make the exception come back to the orchestration

    Mandar Dharmadhikari

    Friday, February 16, 2018 1:11 PM
  • I got SQL Exception to event log.

    Its a two way LOB port.

    Thanks & Regards, Sridhar

    Friday, February 16, 2018 1:36 PM
  • can you paste the entire exception message for us?

    if possible a screen shot of how you are catching the exception

    Mandar Dharmadhikari

    Friday, February 16, 2018 1:39 PM
  • A message sent to adapter "WCF-Custom" on send port "SendPort1" with URI "mssql://ki-laptop58//ars_processing_dev?" is suspended. 
     Error details: System.Data.SqlClient.SqlException (0x80131904): Divide by zero error encountered.

    Server stack trace: 
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndRequest(IAsyncResult result)

    Exception rethrown at [0]: 
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at System.ServiceModel.Channels.IRequestChannel.EndRequest(IAsyncResult result)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)
    Error Number:8134,State:1,Class:16 
     MessageId:  {8A452662-BE98-44A2-B96B-839D00D66187}

    Thanks & Regards, Sridhar

    Friday, February 16, 2018 2:04 PM
  • This is the suspension message for the send port not the orchestration.

    This message is logged in the event log saying that the send port has failed and the instance for the send port is suspended.

    Since the SQL exception is derived from the system.exception class, I am positive that your instance of orchestration is getting completed. 

    Can you please check the tracked service instances? It might shgow you the state of the orchestration.

    Also what are you doing in the exception block? can you put some logging into the exception block and see if that gets logged

    Another way you can check is to select the instance of the orchestration and use the orchestration debugger , that will show you the state of the orch.

    You need to manually terminate the send port suspended instances or you can enable failed message routing to consume those message in some error handling orchestration or redirect them to a folder.

    Mandar Dharmadhikari

    Friday, February 16, 2018 2:18 PM
  • Are you sure you are catching System.Exception and not System.SystemException by mistake?
    Sunday, February 18, 2018 8:31 PM