service vs console

L

Luc E. Mistiaen

I have the following line of code, using System.DirectoryServices and
System.Runtime.InteropServices towards CDOEXM:

((CDOEXM.IExchangeMailbox) User.NativeObject).MoveMailbox (NewHomeMDB) ;

Where User is a DirectoryEntry for a mailbox enbaled user.

This line of code works perfectly when run from a console program and fails
with a 'Catastrophic failure' when run from a service. It works from the
service if a console program is started with a System.Diagnostics.Process,
but not straight from the service threads. The service runs with the same
credentials as the interactive process.

Can anybody shed some light about what difference between the two contexts
can cause such a failure. I already looked at STA vs MTA stuff, but that
didn't solve the issue.

/LM
 
I

Ignacio Machin \( .NET/ C# MVP \)

under what user the service is running?

probably it's under localsystem


cheers,
 
W

Willy Denoyette [MVP]

Luc E. Mistiaen said:
I have the following line of code, using System.DirectoryServices and
System.Runtime.InteropServices towards CDOEXM:

((CDOEXM.IExchangeMailbox) User.NativeObject).MoveMailbox (NewHomeMDB) ;

Where User is a DirectoryEntry for a mailbox enbaled user.

This line of code works perfectly when run from a console program and
fails with a 'Catastrophic failure' when run from a service. It works from
the service if a console program is started with a
System.Diagnostics.Process, but not straight from the service threads. The
service runs with the same credentials as the interactive process.

Can anybody shed some light about what difference between the two contexts
can cause such a failure. I already looked at STA vs MTA stuff, but that
didn't solve the issue.

/LM

Only thing I see is that the user profile is not loaded and that HKCU points
to the "default" hive when run from a service. Not sure why CDOEXM would
need both to be available, but to be sure you could try to run the
regmon.exe from sysinternals (www.sysinternals.com).

Willy.
 
L

Luc E. Mistiaen

Ignacio Machin ( .NET/ C# MVP ) said:
under what user the service is running?

probably it's under localsystem
Nope, running under a user account that is also used in the interactive
case.

/LM
 
L

Luc E. Mistiaen

Landi said:
It sounds like rights issue to me.
What OS are you using?
Don't think it is a rights issue, as it works perfectly under the same
account in interactive mode, or even under the service with a spawned
subprocess.

/LM
 
L

Luc E. Mistiaen

Only thing I see is that the user profile is not loaded and that HKCU
points
to the "default" hive when run from a service. Not sure why CDOEXM would
need both to be available, but to be sure you could try to run the
regmon.exe from sysinternals (www.sysinternals.com).

Willy.
Thanks Willy, I'll investigate in that direction.

/LM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top