all groups > dotnet component services > november 2004 >
You're in the

dotnet component services

group:

.net COM+ component writing a file to UNC path causes MSDTC error


.net COM+ component writing a file to UNC path causes MSDTC error spamspamspam NO[at]SPAM andyandleeann.com
11/1/2004 1:57:38 AM
dotnet component services:
I have a com+ component written in vb.net that is installed on a
Win2k3 server. The component reads and writes files to local or
network file path that is sent to it. I need the file that is written
to be 'locked' by the transaction so that a process on another server
cannot access it, so I have the component setup in COM+ with
Transaction.Required on, with the transaction isolation level set to
'serialized'.

Both the main server and the other server run Windows 2003 Server,
with the latest service packs.

This component is able to write the file OK when I write to a local
drive (eg. e:\myfolder) but when the component tries to write a file
to a path specified by a UNC path (e.g \\sn012345\myfolder) I get the
error:

'The partner transaction manager has disabled its support for
remote/network transactions'

I googled this error and found out that network DTC must be enabled,
so I have turned this on on both servers. I have also set the network
security settings on both servers in Component Services->My
Computer->Properties->MSDTC->Security Configuration to all be checked,
as specified in the MS articles that I found on the subject:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/troubleshooting/htm/ebiz_ops_bas_admin_khfe.asp

http://support.microsoft.com/default.aspx?scid=kb;en-us;817064&Product=winsvr2003

I have rebooted both servers, but I still get the same error.

Any help would be much appreciated!

Regards,
Re: .net COM+ component writing a file to UNC path causes MSDTC error Florin Lazar [MSFT]
11/15/2004 11:13:55 PM
Hi Andy,

Are the two servers part of the same Windows domain? If not, you might need
to follow http://blogs.msdn.com/florinlazar/archive/2004/03/02/82916.aspx

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]

Re: .net COM+ component writing a file to UNC path causes MSDTC er Andy Smith
11/19/2004 3:41:05 AM
Florin, thanks for the reply.

Just FYI for anyone else that might come across this error, I found out what
the problem was. In the UNC path I was specifying the server name, eg:

\\sn01234m1\out

instead, I tried putting the IP address in instead, eg.

\\10.120.120.99\out

and this solved the problem! It turned out to be something to do with the
routing and proxy settings on the machine - when the component tried to write
to the "server name" UNC path, the request was somehow treated as not 'local'
to the machine, so was routed elsewhere on the network, hence the 'partner
transaction manager has disabled its support for remote/network transactions'
error. When I used the IP address, the 'bypass proxy for local addresses'
thing kicked in, and the request got routed OK. (Excuse the vagueness of my
explaination, but I'm no networking expert.)

So I guess the moral of my tail is: this error message might not necessarily
indicate the exact cause of the problem - check your network and proxy
settings if all else fails!

Cheers,
Andy.


[quoted text, click to view]
Re: .net COM+ component writing a file to UNC path causes MSDTC error Chandrashekhar Jangamani
12/1/2004 11:52:15 PM
This is a multi-part message in MIME format

------=_NextPart_000_53075412
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

------=_NextPart_000_53075412
Content-Type: text/html; name="_alt.0"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="_alt.0"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4=2E0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html;=
charset=3Dks_c_5601-1987">
<META content=3D"MSHTML 6=2E00=2E3790=2E218" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2><FONT size=3D3>Hi everyone=2E<BR>I'm korean =2ENET
developer=2E<BR>Please forgive my worthless english=2E<BR><BR>Well, I=
developing a
distributed web application using ASP=2ENET with C#=2E<BR>I have a=
six Windows
Server 2003 based web servers and two SQL Server 2000<BR>database=

servers=2E<BR><BR>I create a COM+ pooled component which supports=
Transaction
service<BR>Activation type of this component is Library, and=
enlisted
distributed<BR>transaction by<BR>EnlistDistributedTransaction=
method of
SqlConnection class=2E<BR><BR>I set a connection string as
follow:<BR><BR>**************************************************=
**************************<BR>***********************************=
<BR>Data
source=3D(local);Initial<BR>Catalog=3Ddatabase_name&amp;uid=3Duser_id&a=
mp;pwd=3Dpassword&amp;pooling=3Dfalse&amp;enlist=3Dfalse<BR>***********=
*****************************************************************=
<BR>***********************************<BR><BR>and
create a class as
follow:<BR><BR>**************************************************=
**************************<BR>***********************************=
<BR>[Transaction(TransactionOption=2ESupported)]<BR>[ObjectPooling(=
true)]<BR>[JustInTimeActivation(true)]<BR>public
class InnerComponent : ServicedComponent {<BR>&nbsp;&nbsp;&nbsp;=
private
SqlConnection cn =3D
null;<BR>}<BR>***************************************************=
*************************<BR>***********************************<=
BR><BR>now,
I implements a Constructor and override Activate and Deactivate=
method<BR>like
this:<BR><BR>****************************************************=
************************<BR>***********************************<B=
R>public
InnerComponent() {<BR>&nbsp;&nbsp;&nbsp;&nbsp; if (this=2Ecn =3D=3D=
null)
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
this=2Ecn =3D new
SqlConnection(connectString);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;
this=2Ecn=2EOpen();<BR>&nbsp;&nbsp;&nbsp;&nbsp;=
}<BR>}<BR><BR>protected override
void Activate() {<BR>&nbsp;&nbsp;&nbsp;&nbsp; if=
(ContextUtil=2EIsInTransaction)
{<BR><BR>this=2Ecn=2EEnlistDistributedTransaction((ITransaction)Conte=
xtUtil=2ETransaction);<BR>&nbsp;&nbsp;&nbsp;&nbsp;
}<BR>}<BR><BR>protected override void Deactivate()=
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;
this=2Ecn=2EEnlistDistributedTransaction(null);<BR>}<BR>*************=
***************************************************************<B=
R>***********************************<BR><BR>then
I implement a COM+ component which call the method of
InnerComponent<BR>component with following
attribute:<BR><BR>***********************************************=
*****************************<BR>********************************=
***<BR>Transaction(TransactionOption=2ERequiresNew)<BR>ObjectPoolin=
g(true)<BR>JustInTimeActivation(true)<BR>public
class OuterComponent
{=2E=2E=2E}<BR>********************************************************=
********************<BR>***********************************<BR><B=
R>When
I call the method of InnerComponent component (even if i don't=
show<BR>here)
using OuterComponent,<BR>EnlistDistributedTransaction method=
which called in
Activate method, works<BR>exactly=2E<BR><BR>But I install this=
components on web
server, and call the method of<BR>InnerComponent
component,<BR>EnlistDistributedTransaction method throw
COMException=2E<BR><BR>exception occurs by=
EnlistDistributedTransaction method=2E
but<BR>ContextUtil=2EIsInTransaction property returns true=2E<BR>and=

ContextUtil=2ETransaction property returns a reference of=
__ComObject<BR>but
EnlistDistributedTransaction method doesn't enlisted=
SqlConnection class<BR>to
COM+ transaction context=2E<BR><BR>I installed a Network DTC access=
component and
Network COM+ access component<BR>on all Windows Server 2003 based=
web servers
and SQL Server 2000 based<BR>database servers=2E<BR><BR>The=
"DTCPing" application
which downloads from microsoft=2Ecom reports there<BR>is no problem=
to communicate
between servers=2E<BR>but SqlConnection class can't enlisted COM+
transaction=2E<BR><BR>well, what can I=
do?<BR><BR>regards<BR><BR>webgenie=2E<BR>from
Korea, Republic=
of=2E</FONT><BR><BR><BR></FONT></DIV></BODY></HTML>


AddThis Social Bookmark Button