Groups | Blog | Home
all groups > dotnet component services > may 2004 >

dotnet component services : Error handling in Serviced Components


Arpan Patel via .NET 247
5/13/2004 11:22:55 AM
Hi all,

I am having a problem figuring out error handling with my=
serviced component=2E I am reading data from the database and I=
get deadlock errors=2E To solve deadlock, i catch that error and=
resubmit it and i get following error: "Distributed transaction=
completed=2E Either enlist this session in a new transaction or=
the NULL transaction=2E" Any idea what i can do here? it seems=
like that the transaction is setting to complete=2E I have added=
code to disable setcomplete but it still doesnt work=2E Here is=
the psuedo code for what i am doing:

private sub GetData(=2E=2E=2E)

Try
GetDatafromDb()
Catch ex
if error =3D deadlock then
ContextUtil=2EDisableCommit()
GetData (resubmit)
else
throw ex
End If

End Try

End sub

Please let me know what I am doing wrong=2E Thank you=2E
--------------------------------
From: Arpan Patel

-----------------------
Posted by a user from =2ENET 247 (http://www=2Edotnet247=2Ecom/)

Florin Lazar [MSFT]
5/30/2004 6:29:27 PM
Hi Arpan,

It looks like your database is aborting the transaction when it detects the
deadlock. Setting DisableCommit will not help. You need to bubble up the
error outside the layer that started the transaction. You can't do any
database work as part of this doomed transaction.

Regards,
--
Florin Lazar - Microsoft - [ http://blogs.msdn.com/florinlazar ]
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


[quoted text, click to view]
Hi all,

I am having a problem figuring out error handling with my serviced
component. I am reading data from the database and I get deadlock errors.
To solve deadlock, i catch that error and resubmit it and i get following
error: "Distributed transaction completed. Either enlist this session in a
new transaction or the NULL transaction." Any idea what i can do here? it
seems like that the transaction is setting to complete. I have added code
to disable setcomplete but it still doesnt work. Here is the psuedo code
for what i am doing:

private sub GetData(...)

Try
GetDatafromDb()
Catch ex
if error = deadlock then
ContextUtil.DisableCommit()
GetData (resubmit)
else
throw ex
End If

End Try

End sub

Please let me know what I am doing wrong. Thank you.
--------------------------------
From: Arpan Patel

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>DWXCSg+RWEyWOU0Cpd/rpg==</Id>

AddThis Social Bookmark Button