|
|
|
date: Thu, 22 May 2008 14:31:28 +0100,
group: microsoft.public.dotnet.framework.component_services
back
Calling .NET Serviced Component from VB6 COM+ method
Hi all,
We've spent a couple of days on this trying to find the solution to the
following problem.
We have a legacy ASP application that, stage by stage, we're migrating to
.NET. This means that at a number of places, legacy code and .NET managed
code needs to interact.
The legacy application is standard ASP calling COM+ objects written in VB6.
The .NET back-end code is called from the existing COM+ objects and is
declared at a high level:
[Transaction(TransactionOption.Required)]
public class Messaging : ServicedComponent
{
public void Initialise (string dbSystem)
{
.
.
.
}
[AutoComplete]
public string sendMessage ()
{
.
.
.
}
}
From VB6, the method and object is called as for any other object:
Dim obj
Set obj = CreateObject ("<namespace>.Messaging")
Call obj.Initialise("TESTING")
Call obj.sendMessage()
Set obj = Nothing
The problem we're getting is that we can call the .NET method sendMessage()
once from within the COM+ code, and everything works as expected. Second and
subsequent calls fail, with "Distributed transaction completed. Either
enlist this session in a new transaction or the NULL transaction.".
If, from within the Component Services MMC tool we shutdown the COM+
application containing the .NET methods and try the transaction again, the
transaction suceeds.
The implication seems to be that after the first call, the .NET code isn't
deactivating and is still subscribed to the first transaction - thus
subsequent calls into the serviced component tell us that the transaction
has completed (referring to the first transaction).
Is there any method or property that we're missing, or are we doing
something fundamentally wrong? We've found plenty of articles that talk
about .NET to Serviced .NET or .NET to existing COM+, but can't find
anything to map legacy behaviour to .NET.
Any suggestions?
Cheers,
Chris...
date: Thu, 22 May 2008 14:31:28 +0100
author: Chris Johnson
Re: Calling .NET Serviced Component from VB6 COM+ method
From the design of your component I'm assuming that you are using a
transaction to wrap these two calls in your ASP page, right?
Since the first method did not include the AutoComplete attribute, are you
remembering to vote on the transaction before leaving the COM+ method?
Even though you don't have the set the done bit, you still have to set the
vote bit.
Morty
"Chris Johnson" wrote in message
news:#JxU0ABvIHA.4476@TK2MSFTNGP06.phx.gbl...
> Hi all,
>
> We've spent a couple of days on this trying to find the solution to the
> following problem.
>
> We have a legacy ASP application that, stage by stage, we're migrating to
> .NET. This means that at a number of places, legacy code and .NET managed
> code needs to interact.
>
> The legacy application is standard ASP calling COM+ objects written in
> VB6.
>
> The .NET back-end code is called from the existing COM+ objects and is
> declared at a high level:
>
> [Transaction(TransactionOption.Required)]
> public class Messaging : ServicedComponent
> {
> public void Initialise (string dbSystem)
> {
> .
> .
> .
> }
>
> [AutoComplete]
> public string sendMessage ()
> {
> .
> .
> .
> }
> }
>
> From VB6, the method and object is called as for any other object:
>
> Dim obj
> Set obj = CreateObject ("<namespace>.Messaging")
> Call obj.Initialise("TESTING")
> Call obj.sendMessage()
> Set obj = Nothing
>
> The problem we're getting is that we can call the .NET method
> sendMessage() once from within the COM+ code, and everything works as
> expected. Second and subsequent calls fail, with "Distributed transaction
> completed. Either enlist this session in a new transaction or the NULL
> transaction.".
>
> If, from within the Component Services MMC tool we shutdown the COM+
> application containing the .NET methods and try the transaction again, the
> transaction suceeds.
>
> The implication seems to be that after the first call, the .NET code isn't
> deactivating and is still subscribed to the first transaction - thus
> subsequent calls into the serviced component tell us that the transaction
> has completed (referring to the first transaction).
>
> Is there any method or property that we're missing, or are we doing
> something fundamentally wrong? We've found plenty of articles that talk
> about .NET to Serviced .NET or .NET to existing COM+, but can't find
> anything to map legacy behaviour to .NET.
>
> Any suggestions?
>
> Cheers,
>
> Chris...
>
date: Thu, 22 May 2008 21:13:39 +0200
author: Morten Abrahamsen
|
|