DTC only being used with remoting?

DTC only being used with remoting?

Old forum URL: forums.lhotka.net/forums/t/4032.aspx


ajj3085 posted on Thursday, December 13, 2007

Hi,

I'm trying to track down an odd problem.  I am trying to switch to remoting, and for the most part things are fine.  I'm having problems during a save of a specific business object though.  The object has Company and Department as strings.  If the company does not exist in my CompanyList, it creates a new company, and asks the cached version of CompanyList to reload itself.

Doing so causes DTC to jump in for some reason on the server.  Yet I can disable the DTC service on my workstation (Vista) and the save performs just fine.  But for some reason while the remoted code is running on Win2k3 server hosted by IIS, DTC wants to start but since its disabled on the server as well, the whole transaction fails.

Any ideas why this would seem to happen?

ajj3085 replied on Friday, December 14, 2007

No one has any ideas? 

RockfordLhotka replied on Friday, December 14, 2007

I assume you are using the TransactionScope option on your dp_update method?

And in this scenario you are opening 2+ database connections within the context of the dp_update?

That would trigger the DTC, and should in both environments.

ajj3085 replied on Friday, December 14, 2007

Yes, I'm using TransactionScope.  I'm only opening one connection, as far as I can tell.  I'm inclined to believe I'm not opening more than one, since DTC is disabled and not running in all configurations I test (both on the client and the server).

With DTC disabled on both cilent and server, the code runs fine in 2-tier mode, but enabling remoting the server starts complaining about DTC being disabled.

What's worse, is that I can run the application via ClickOnce on the server, by xcopying to the server and running causes an immediate crash.. something to do with partiallytrustedcallers.

ajj3085 replied on Friday, December 14, 2007

Ok.  I setup the Clickonce application to run without remoting, and this launched on the server.  DTC is a disabled service on the server.  The save works fine.. so it always works fine in 2-tier mode with DTC disabled, but not with 3-tier mode.

I'm at a loss on this one..

RockfordLhotka replied on Friday, December 14, 2007

I have no idea to be honest. Clearly there's something different in your data portal host process that is somehow triggering the DTC - which implies that there's a second resource manager getting involved in there somewhere. Or that your connection string is somehow different and that is triggering it?

ajj3085 replied on Friday, December 14, 2007

I finally figured this out.  My DP_I was closing the connection, but in the BO I had code in OnDataPortalCompleted which attempted to refresh the list.  This would then open a second connection, causing the error.   Also, since this code only executed if the ExecutionLocation was Server (and in 2-tier, it never is) it only showed up when I turned on remoting.  I never thought to check OnDataPortalCompleted, because 1) I forgot about the code there and 2) I didn't think that would be covered under the transaction.

Changing the server code to just invalid the list (the refresh is for UI only, to update any combos which have a list of companies) fixes the issue.

Copyright (c) Marimer LLC