469,582 Members | 2,373 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,582 developers. It's quick & easy.

Windows Service Starts and Immediately Stops

Hi.

I know my windows service works when i run it in debug mode on my dev
machine.
It also works in release mode on my dev machine. But, when I move the
service to
a production server, it exits immediately with a start/stop/nothing to
do error.

What could be wrong?

My OnStart looks like this:

protected override void OnStart(string[] args)
{
InitIndexer();
}

and InitIndexer() is a lengthly bit of code making up the meat of the
service.

any ideas?

thanks.
Jan 7 '08 #1
41 11049
On Jan 7, 10:11*am, pbd22 <dush...@gmail.comwrote:
Hi.

I know my windows service works when i run it in debug mode on my dev
machine.
It also works in release mode on my dev machine. But, when I move the
service to
a production server, it exits immediately with a start/stop/nothing to
do error.

What could be wrong?

My OnStart looks like this:

*protected override void OnStart(string[] args)
* * * * {
* * * * * * InitIndexer();
* * * * }

and InitIndexer() is a lengthly bit of code making up the meat of the
service.

any ideas?

thanks.
services can be a bit of a pain to debug as you can't just attach a
debugger. as you'll want event logging before you release your app
anyway, mind as well just put it in now, and use it for debugging
also. you can then trace out exactly what you want in your code and
see where things go ary.

your log method is simple, something like:

private void LogEvent(string LogMessage, EventLogEntryType
LogEntryType)
{
if (!EventLog.SourceExists(_eventSource))
{
EventLog.CreateEventSource(_eventSource, _logAppName);
}

EventLog MyLog = new EventLog();
MyLog.Source = _eventSource;
MyLog.WriteEntry(LogMessage, LogEntryType);
}

with caller

LogEvent(string.Format("Error in Service:OnStart() {1}", ex.Message),
EventLogEntryType.Error);

dave
Jan 7 '08 #2
Thanks Dave,

So, the code should look like this? :

protected override void OnStart(string[] args)
{
try
{
InitIndexer();
}
catch(Exception ex)
{
LogEvent(string.Format("Error in
VBIndexerService:OnStart() {1}", ex.Message),
EventLogEntryType.Error);
}
}
Jan 7 '08 #3
OK.

Went to the event logs and see all sorts of COM object access denied
errors.
Seems the DLLs I registered in the DEV environment are not firing when
I
move everything to the production server (my guess).

Example:

Event Type: Error
Event Source: My Source
Event Category: None
Event ID: 0
Date: 1/7/2008
Time: 1:29:54 PM
User: N/A
Computer: My Computer
Description:
WindowsXYZServer.GetSpace() Access is denied. (Exception from HRESULT:
0x80070005 (E_ACCESSDENIED))

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.

Question:

If I register a DLL as a certain path in my DEV system, say:

C:/x/y/z/library.DLL

and then I move the windows service to:

C:/a/b/c/

and put the DLLs in

C:/a/b/c/library.DLL

does that fudge up everything?

Must the path of the DLL files in the development
system match the path of the DLL files on the live server?

Thanks.
Jan 7 '08 #4
Hi,
The OnStart is suppose to be short, the solution to your problem execute
your method in another thread:

protected override void OnStart(string[] args)
{
new Thread( new ThreadStart( InitIndexer)).Start();
}
--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"pbd22" <du*****@gmail.comwrote in message
news:1a**********************************@41g2000h sy.googlegroups.com...
Hi.

I know my windows service works when i run it in debug mode on my dev
machine.
It also works in release mode on my dev machine. But, when I move the
service to
a production server, it exits immediately with a start/stop/nothing to
do error.

What could be wrong?

My OnStart looks like this:

protected override void OnStart(string[] args)
{
InitIndexer();
}

and InitIndexer() is a lengthly bit of code making up the meat of the
service.

any ideas?

thanks.

Jan 7 '08 #5
Hi,

See my other post for a solution, Your problem is taht the window's service
control manager expect that the service startup be complete in a short
amount of time. Otherwise it stop it. You have to use a thread.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"pbd22" <du*****@gmail.comwrote in message
news:f3**********************************@d70g2000 hsb.googlegroups.com...
Thanks Dave,

So, the code should look like this? :

protected override void OnStart(string[] args)
{
try
{
InitIndexer();
}
catch(Exception ex)
{
LogEvent(string.Format("Error in
VBIndexerService:OnStart() {1}", ex.Message),
EventLogEntryType.Error);
}
}

Jan 7 '08 #6
"pbd22" <du*****@gmail.comwrote in message
news:81**********************************@k39g2000 hsf.googlegroups.com...
OK.

Went to the event logs and see all sorts of COM object access denied
errors.
Seems the DLLs I registered in the DEV environment are not firing when
I
move everything to the production server (my guess).

Example:

Event Type: Error
Event Source: My Source
Event Category: None
Event ID: 0
Date: 1/7/2008
Time: 1:29:54 PM
User: N/A
Computer: My Computer
Description:
WindowsXYZServer.GetSpace() Access is denied. (Exception from HRESULT:
0x80070005 (E_ACCESSDENIED))

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.

Question:

If I register a DLL as a certain path in my DEV system, say:

C:/x/y/z/library.DLL

and then I move the windows service to:

C:/a/b/c/

and put the DLLs in

C:/a/b/c/library.DLL

does that fudge up everything?

Must the path of the DLL files in the development
system match the path of the DLL files on the live server?

Thanks.

We can't help you if you don't tell us what the code is doing, only posting
a snippet that shows nothing isn't of any help.
From the above it looks like (suppose the eventlog entries have something to
do with the service) you are calling a COM server, for which the caller has
no access permissions. So, you'll have to adjust the Access Permissions for
the COM server using DCOMCNFG.

Willy.

Jan 7 '08 #7
On Jan 7, 2:19 pm, "Willy Denoyette [MVP]"
<willy.denoye...@telenet.bewrote:
"pbd22" <dush...@gmail.comwrote in message

news:81**********************************@k39g2000 hsf.googlegroups.com...
OK.
Went to the event logs and see all sorts of COM object access denied
errors.
Seems the DLLs I registered in the DEV environment are not firing when
I
move everything to the production server (my guess).
Example:
Event Type: Error
Event Source: My Source
Event Category: None
Event ID: 0
Date: 1/7/2008
Time: 1:29:54 PM
User: N/A
Computer: My Computer
Description:
WindowsXYZServer.GetSpace() Access is denied. (Exception from HRESULT:
0x80070005 (E_ACCESSDENIED))
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
Question:
If I register a DLL as a certain path in my DEV system, say:
C:/x/y/z/library.DLL
and then I move the windows service to:
C:/a/b/c/
and put the DLLs in
C:/a/b/c/library.DLL
does that fudge up everything?
Must the path of the DLL files in the development
system match the path of the DLL files on the live server?
Thanks.

We can't help you if you don't tell us what the code is doing, only posting
a snippet that shows nothing isn't of any help.
From the above it looks like (suppose the eventlog entries have something to
do with the service) you are calling a COM server, for which the caller has
no access permissions. So, you'll have to adjust the Access Permissions for
the COM server using DCOMCNFG.

Willy.
Thanks Willy,

The code is writing to a number of text files.
The writing happens by calling a COM object which is a DLL reference
in the project.
Access to the COM objects is what is throwing the errors. I don't have
a COM server,
but COM DLLs in the same folder as the windows service.

How Do I prevent this error for COMs called locally?

Please let me know if you need other information otherwise, thanks for
your help.

Jan 7 '08 #8
Ignacio -

Thanks.

I tried your code and the start/stop error disappeared
but the service is still not working. I notice that when
I go to task manager i don't see myservice.exe in the
processes list.

I think this is due to access to my COM objects. How
is this resolved?

Thanks.
Jan 7 '08 #9
Your "COM dll's" are what Willy is referring to when he uses the
interchangeable term "COM server". Dcomcnfig can be used to adjust the Launch
permissions and remove the errors.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"pbd22" wrote:
On Jan 7, 2:19 pm, "Willy Denoyette [MVP]"
<willy.denoye...@telenet.bewrote:
"pbd22" <dush...@gmail.comwrote in message

news:81**********************************@k39g2000 hsf.googlegroups.com...
OK.
Went to the event logs and see all sorts of COM object access denied
errors.
Seems the DLLs I registered in the DEV environment are not firing when
I
move everything to the production server (my guess).
Example:
Event Type: Error
Event Source: My Source
Event Category: None
Event ID: 0
Date: 1/7/2008
Time: 1:29:54 PM
User: N/A
Computer: My Computer
Description:
WindowsXYZServer.GetSpace() Access is denied. (Exception from HRESULT:
0x80070005 (E_ACCESSDENIED))
For more information, see Help and Support Center at
>http://go.microsoft.com/fwlink/events.asp.
Question:
If I register a DLL as a certain path in my DEV system, say:
C:/x/y/z/library.DLL
and then I move the windows service to:
C:/a/b/c/
and put the DLLs in
C:/a/b/c/library.DLL
does that fudge up everything?
Must the path of the DLL files in the development
system match the path of the DLL files on the live server?
Thanks.
We can't help you if you don't tell us what the code is doing, only posting
a snippet that shows nothing isn't of any help.
From the above it looks like (suppose the eventlog entries have something to
do with the service) you are calling a COM server, for which the caller has
no access permissions. So, you'll have to adjust the Access Permissions for
the COM server using DCOMCNFG.

Willy.

Thanks Willy,

The code is writing to a number of text files.
The writing happens by calling a COM object which is a DLL reference
in the project.
Access to the COM objects is what is throwing the errors. I don't have
a COM server,
but COM DLLs in the same folder as the windows service.

How Do I prevent this error for COMs called locally?

Please let me know if you need other information otherwise, thanks for
your help.

Jan 7 '08 #10
"pbd22" <du*****@gmail.comwrote in message
news:22**********************************@41g2000h sy.googlegroups.com...
On Jan 7, 2:19 pm, "Willy Denoyette [MVP]"
<willy.denoye...@telenet.bewrote:
>"pbd22" <dush...@gmail.comwrote in message

news:81**********************************@k39g200 0hsf.googlegroups.com...
OK.
Went to the event logs and see all sorts of COM object access denied
errors.
Seems the DLLs I registered in the DEV environment are not firing when
I
move everything to the production server (my guess).
Example:
Event Type: Error
Event Source: My Source
Event Category: None
Event ID: 0
Date: 1/7/2008
Time: 1:29:54 PM
User: N/A
Computer: My Computer
Description:
WindowsXYZServer.GetSpace() Access is denied. (Exception from HRESULT:
0x80070005 (E_ACCESSDENIED))
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
Question:
If I register a DLL as a certain path in my DEV system, say:
C:/x/y/z/library.DLL
and then I move the windows service to:
C:/a/b/c/
and put the DLLs in
C:/a/b/c/library.DLL
does that fudge up everything?
Must the path of the DLL files in the development
system match the path of the DLL files on the live server?
Thanks.

We can't help you if you don't tell us what the code is doing, only
posting
a snippet that shows nothing isn't of any help.
From the above it looks like (suppose the eventlog entries have something
to
do with the service) you are calling a COM server, for which the caller
has
no access permissions. So, you'll have to adjust the Access Permissions
for
the COM server using DCOMCNFG.

Willy.

Thanks Willy,

The code is writing to a number of text files.
The writing happens by calling a COM object which is a DLL reference
in the project.
Access to the COM objects is what is throwing the errors. I don't have
a COM server,
but COM DLLs in the same folder as the windows service.

How Do I prevent this error for COMs called locally?

Please let me know if you need other information otherwise, thanks for
your help.

Ok forget about DCOMCNFG as it's an in-proc server, the COM server however,
is calling into Win32 to access the folder using the credentials of the
service account, this account in does not have permissions to write to the
destination folder. That means you'll need to run your service in an account
with sufficient permissions to access the local folder/files.

Willy.

Jan 7 '08 #11
"Peter Bromberg [C# MVP]" <pb*******@yahoo.NoSpamMaam.comwrote in message
news:1F**********************************@microsof t.com...
Your "COM dll's" are what Willy is referring to when he uses the
interchangeable term "COM server". Dcomcnfig can be used to adjust the
Launch
permissions and remove the errors.
-- Peter
Peter,

Not exactly, I was assuming an out-proc server, but it looks like it's an
in-proc, so dcomcnfg is not applicable here.

Willy.

Jan 7 '08 #12
Peter -

"run your service in an account"

How do I find this out?
How do I make sure the account has read/write permissions.
And, more importantly, able to read the amount of space on the disk
(per the original error)?

I see the following in my service code:

this.serviceProcessInstaller1.Account =
System.ServiceProcess.ServiceAccount.LocalSystem;

My service has LocalSystem access which seems to be sufficient
according to some
threads I have read.

Is this what you mean? If not, could you be specific about where I
need to make these changes?

THanks.
Jan 7 '08 #13
sorry, that was directed to Willy.
Jan 7 '08 #14
"pbd22" <du*****@gmail.comwrote in message
news:8b**********************************@s19g2000 prg.googlegroups.com...
Peter -

"run your service in an account"

How do I find this out?
How do I make sure the account has read/write permissions.
And, more importantly, able to read the amount of space on the disk
(per the original error)?

I see the following in my service code:

this.serviceProcessInstaller1.Account =
System.ServiceProcess.ServiceAccount.LocalSystem;

My service has LocalSystem access which seems to be sufficient
according to some
threads I have read.

Is this what you mean? If not, could you be specific about where I
need to make these changes?

THanks.

This message:
Event Source: My Source
.....
WindowsXYZServer.GetSpace() Access is denied. (Exception from HRESULT:
0x80070005 (E_ACCESSDENIED))
is written to the eventlog by your service (Source: My Source), right?. This
means that you are dealing with a security issue, the caller has no access
to a resource, which one is up to you to tell us.

WindowsXYZServer.GetSpace() is probably the method you are calling,
questions are:
- who exactly writes the error to the eventlog?
- what is "WindowsXYZServer" referring to, a managed class method or a COM
method?
- what is GetSpace doing, what resource is it accessing and how?
- and ... are you sure you don't call into a DCOM server somehow?

Willy.

Jan 7 '08 #15
is written to the eventlog by your service (Source: My Source), right?
no. The source as described in the "Services" window is not my
service.
It is "MyCompany OurProduct". The only EventLog info coming back from
my service is that it started successfully.
WindowsXYZServer.GetSpace() is probably the method you are calling,
questions are:
- who exactly writes the error to the eventlog?
- what is "WindowsXYZServer" referring to, a managed class method or a COM
method?
A COM Method.
- what is GetSpace doing, what resource is it accessing and how?
GetSpace is finding out if the system has enough disk space to write a
large file
to a local directory. I think it uses kernel32.
- and ... are you sure you don't call into a DCOM server somehow?
if by "server" you mean a computer that isn't the localhost, then I
think the answer is no. But, if that is not what you mean, then I am
not sure and could use some advice as to how to better answer you.
Jan 7 '08 #16
"pbd22" <du*****@gmail.comwrote in message
news:fa**********************************@41g2000h sy.googlegroups.com...
>
>is written to the eventlog by your service (Source: My Source), right?

no. The source as described in the "Services" window is not my
service.

Question: Who's writing this message to the eventlog??

It is "MyCompany OurProduct". The only EventLog info coming back from
my service is that it started successfully.
>WindowsXYZServer.GetSpace() is probably the method you are calling,
questions are:
- who exactly writes the error to the eventlog?
>- what is "WindowsXYZServer" referring to, a managed class method or a
COM
method?

A COM Method.
Right.
>
>- what is GetSpace doing, what resource is it accessing and how?

GetSpace is finding out if the system has enough disk space to write a
large file
to a local directory. I think it uses kernel32.
>- and ... are you sure you don't call into a DCOM server somehow?

if by "server" you mean a computer that isn't the localhost, then I
think the answer is no. But, if that is not what you mean, then I am
not sure and could use some advice as to how to better answer you.
I'm talking about software components, not a computer, when talking about
COM (or any other distributed system) you have clents and servers, a clients
is the component that creates instances of a class and calls methods of that
class, the server is that part that implements the class. COM knows two kind
of servers, in-proc (DLL's) and out-proc servers. in-proc servers (DLL's)
are always loaded in the clients process, out-proc servers always run in a
process separate from the client (on the same or on another machine).
Question: - what kind of server is it (in or out-proc)?
- what's the language it is written in?
- did you register the server on the target system?
- who's the owner of the code of this COM server, he should be able to give
an answer to all these questions.

Willy.

Jan 8 '08 #17
On Jan 7, 3:56 pm, "Willy Denoyette [MVP]"
<willy.denoye...@telenet.bewrote:
"pbd22" <dush...@gmail.comwrote in message

news:fa**********************************@41g2000h sy.googlegroups.com...
is written to the eventlog by your service (Source: My Source), right?
no. The source as described in the "Services" window is not my
service.

Question: Who's writing this message to the eventlog??
It is "MyCompany OurProduct". The only EventLog info coming back from
my service is that it started successfully.
WindowsXYZServer.GetSpace() is probably the method you are calling,
questions are:
- who exactly writes the error to the eventlog?
- what is "WindowsXYZServer" referring to, a managed class method or a
COM
method?
A COM Method.

Right.
- what is GetSpace doing, what resource is it accessing and how?
GetSpace is finding out if the system has enough disk space to write a
large file
to a local directory. I think it uses kernel32.
- and ... are you sure you don't call into a DCOM server somehow?
if by "server" you mean a computer that isn't the localhost, then I
think the answer is no. But, if that is not what you mean, then I am
not sure and could use some advice as to how to better answer you.

I'm talking about software components, not a computer, when talking about
COM (or any other distributed system) you have clents and servers, a clients
is the component that creates instances of a class and calls methods of that
class, the server is that part that implements the class. COM knows two kind
of servers, in-proc (DLL's) and out-proc servers. in-proc servers (DLL's)
are always loaded in the clients process, out-proc servers always run in a
process separate from the client (on the same or on another machine).
Question: - what kind of server is it (in or out-proc)?
You may not like this answer but it is both. I have numerous DLLs in
this
project that call COM objects. I also have an EXE called from inside
the same project
that runs an external process that, itself, calls COM objects. But,
this error relates
to in-proc I think.
- what's the language it is written in?
C#
- did you register the server on the target system?
By "register the server" do you mean using gacutil for the DLLs?
If that is what you mean, I think I have but I will check again.
- who's the owner of the code of this COM server, he should be able to give
an answer to all these questions.
Well, I am the owner of the C# code. But the COM objects were written
by
a programmer before me - in VB6. She is gone and I am left to call
these classes
from within my own code with out too much prior knowledge of the inner
workings of
the DLLs.

Peter

Jan 8 '08 #18
OK,

First, I think it is worth mentioning that the program in
question is a windows service.

If you mean "register the DLLs" in your previous query,
I feel silly, but I don't think I actually registered the DLLs
on the target server. I registered the DLLs inside my
IDE and everything worked just fine so, I guess I didn't
think to do anything different on the target machine. My Bad.

So, I am guessing I have my three Interop DLLs to register
on the target machine. But, when I try the below command:

RegAsm.exe "C:\PATH\Interop.MYDLL.dll" /tlb:Interop.MYDLL.tlb

I get the following error:

Types registered successfully
RegAsm: error RA0000 : CLR assembly "C:\PATH\Interop.MYDLL.dll" was
imported from a type library and cannot be re-exported to a type
library. Made sure the type library from which the assembly was
imported is registered.

Do you think this is the solution to my permissions error and, if you
do, or, if
you think I should be doing this, then what am I doing wrong???

Thanks again.
Jan 8 '08 #19
"pbd22" <du*****@gmail.comwrote in message
news:88**********************************@z17g2000 hsg.googlegroups.com...
OK,

First, I think it is worth mentioning that the program in
question is a windows service.

If you mean "register the DLLs" in your previous query,
I feel silly, but I don't think I actually registered the DLLs
on the target server. I registered the DLLs inside my
IDE and everything worked just fine so, I guess I didn't
think to do anything different on the target machine. My Bad.

So, I am guessing I have my three Interop DLLs to register
on the target machine. But, when I try the below command:

RegAsm.exe "C:\PATH\Interop.MYDLL.dll" /tlb:Interop.MYDLL.tlb

I get the following error:

Types registered successfully
RegAsm: error RA0000 : CLR assembly "C:\PATH\Interop.MYDLL.dll" was
imported from a type library and cannot be re-exported to a type
library. Made sure the type library from which the assembly was
imported is registered.
No, no, In a previous reply you said that the dll's were VB6 (native) COM
dll's, you don't (can't) have to registered these with regasm!!!!
Do you think this is the solution to my permissions error and, if you
do, or, if
you think I should be doing this, then what am I doing wrong???

Thanks again.


Sorry, but if you don't or can't answer the question "who's writing the
error message to the eventlog", it will be very hard to help you out with
this. So, you need to find out which components writes to the eventlog.
Also you keep "guessing" about what other components you are dealing with,
what started as a "Service stops immediately", has become; a service that
calls into COM that call into exe that calls back into COM.
You need to have a clear overview about the different components in your
solution, you need to know exactly which are managed and which are
unmanaged, which are COM and which are not.
You need to know exactly which one calls the other and what resources each
of them are accessing, one (or more) of them (the
WindowsXYZServer.GetSpace() method/function) does *not* have the appropriate
rights to access a resource, because it runs in a security context (an
account) that has no privileges to do what is supposed to be done in that
method.
With "register DLL's" in terms of native COM dll's or exe's, I mean that
COM servers (DLL's and EXE's) need to be registered on the target system, by
running regsvr32 <mynativecom.dllin case of a DLL, or running the server
exe with the option register (somecomserver.exe /register) in case of an exe
COM server. You can't call into the COM objects without registering.
You also have an *exe* in the solution that gets *called* by ?? and calls
into COM. What kind of exe is this? how is it "called"? Is it getting called
in terms of method calls, or do you mean that it's getting started from
within another component?

Willy.
Jan 8 '08 #20

OK, thanks for your patience. I can answer most of the below to the
best of my ability except #1. I will have an answer to that ASAP.
But, for now...

1) What component is writing the error message to the eventlog".

I am sorry but I am still trying to figure out where to look to answer
this
question. I will come back with a reply as soon as I figure it out.

2) You also have an *exe* in the solution that gets *called* by ??

We had an STA/MTA problem in our project that was solved by calling
an external VB6 project. It gets called using System.Diagnostics.

3) What kind of exe is this?

The exe is a VB6 project that, itself makes calls to the same DLLs
that my C#
project uses.

4) how is it "called"?

ProcessStartInfo psi = new ProcessStartInfo(path, file);

I then put a lock on the process and write a basic run/enqueue block.

5) Is it getting called in terms of method calls, or do you mean that
it's getting started from
within another component?

The exe gets fired if a certain code block evaluates to true. So, I
believe the answer
to your question is method calls.
Jan 8 '08 #21
I think I should also add that the EXE file, while sloppy, is not
likely to explain (or contribute to)
the current problem (I am guessing). The current folder only has files
of a certain type. This means that the code block that fires the exe
will never be entered.
Jan 8 '08 #22
"pbd22" <du*****@gmail.comwrote in message
news:da**********************************@x69g2000 hsx.googlegroups.com...
>
OK, thanks for your patience. I can answer most of the below to the
best of my ability except #1. I will have an answer to that ASAP.
But, for now...

1) What component is writing the error message to the eventlog".

I am sorry but I am still trying to figure out where to look to answer
this
question. I will come back with a reply as soon as I figure it out.

2) You also have an *exe* in the solution that gets *called* by ??

We had an STA/MTA problem in our project that was solved by calling
an external VB6 project. It gets called using System.Diagnostics.
What kind of STA/MTA problems are you expecting to solve, that could not be
solved in the service?
3) What kind of exe is this?

The exe is a VB6 project that, itself makes calls to the same DLLs
that my C#
project uses.
VB6 project right, but is the exe a windows program or an ActiveX exe (
out-proc COM server)?
4) how is it "called"?

ProcessStartInfo psi = new ProcessStartInfo(path, file);
This is how the program is is getting started, which is not what I mean with
"getting called". So I guess it's a simple standalone exe, which does not
expose methods that you can call from a client.

I then put a lock on the process and write a basic run/enqueue block.

5) Is it getting called in terms of method calls, or do you mean that
it's getting started from
within another component?

The exe gets fired if a certain code block evaluates to true. So, I
believe the answer
to your question is method calls.
This is the confusing part, are you calling methods on this exe from your
service code?
As I said before, my guess is that this exe is stand-alone, in the sense
that it's getting *started* from within your service, but it's functionality
is never called in terms of method calls from external clients (your
service).

To resume, as far as I can see, this is what you have:

A Windows Service (C#) that calls into native COM (VB6 dll's),
The service starts an ( VB6 ) exe (conditional), that on it's turn calls the
same COM objects as above.
The service runs as LocalSystem, the VB6 exe runs in the same security
context as the service, that is it runs as a background program in the
LocalSystem account.
There is no single component that explicitly interacts with the users
desktop.
One components has a security issue when accessing a (disk) resource, and
logs this fact to the eventlog.

First thing you need to find out is, which component writes to the log and
why.
Second thing you need to find out is what kind of exe the VB6 EXE is, none
of the VB6 EXE's are well suited to be called from a service. The reason is
that all of them need to run in an interactive desktop security context. All
VB6 Windows exe's have a visible top level window, while VB6 ActiveX EXE's
have a strong binding with the desktop too.
Another remark is that VB6 EXE's can only create instances of apartment type
COM objects. The same is true for VB6 COM DLL's, VB6 can only build
"apartment" compatible components, these need an STA to run in. Windows
Services (.NET) threads all enter the MTA (by default), so you need to pay
special attention when spawning threads that call into COM, they need to
enter an STA, but STA threads need to pump the windows message queue. So
here you have a potential problem.

Windows services have strong reliability and robustness requirements, they
are also constrained by the security context they run in. The security issue
you are now dealing with is IMO only the begin of a painful experience, the
architecture is not based on reliability design.

Willy.
Jan 8 '08 #23

Thanks again Willy.

Some questions I "can" answer immediately -
What kind of STA/MTA problems are you expecting to solve, that could not be
solved in the service?
The VB6 is STA the service, as you point out is MTA. I tried
designating main as STAThread
and doing other MTA -STA tricks but the DLL continued to fail. The
only way we could get
the dog to hunt was by calling an external program within the service.
VB6 project right, but is the exe a windows program or an ActiveX exe (
out-proc COM server)?
A windows program.
This is how the program is is getting started, which is not what I mean with
"getting called". So I guess it's a simple standalone exe, which does not
expose methods that you can call from a client.
In this case, yes. It is just a simple program. It uses methods I have
access to by way
of the same DLLs.

This is the confusing part, are you calling methods on this exe from your
service code?
I am not calling any methods on the exe in this instance. The exe is a
stand-alone
program that the service simply starts and watches for process
completion.
As I said before, my guess is that this exe is stand-alone, in the sense
that it's getting *started* from within your service, but it's functionality
is never called in terms of method calls from external clients (your
service).
That is correct.
To resume, as far as I can see, this is what you have:
A Windows Service (C#) that calls into native COM (VB6 dll's),
yes.
The service starts an ( VB6 ) exe (conditional), that on it's turn calls the
same COM objects as above.
yes.
The service runs as LocalSystem, the VB6 exe runs in the same security
context as the service, that is it runs as a background program in the
LocalSystem account.
yes.
There is no single component that explicitly interacts with the users
desktop.
Well, the DLLs provide methods that interact with the users desktop
but
the C# program is the one calling the methods and writing to the files
so,
I guess the answer that question is "correct".
One components has a security issue when accessing a (disk) resource, and
logs this fact to the eventlog.
yes.

Also, as a final note, I have been trying to register my DLLs on the
server with
regsvr32 and I keep getting failure due to "Entry Point Not Found".
Can you tell
me why I am getting this?

Thanks again for all your help.
Jan 8 '08 #24
"Second thing you need to find out is what kind of exe the VB6 EXE is"

Standard EXE
Jan 8 '08 #25
Here is the important thing that I suspect still hasn't been done:
COM servers (DLL's and EXE's) need to be registered on the target system,
by running regsvr32 <mynativecom.dllin case of a DLL, or running the
server
Having the DLL in the path or exe directory is NOT sufficient for COM to
work.
Jan 8 '08 #26
working on the outstanding questions...
Jan 8 '08 #27
"pbd22" <du*****@gmail.comwrote in message
news:4e**********************************@q77g2000 hsh.googlegroups.com...
>
Thanks again Willy.

Some questions I "can" answer immediately -
>What kind of STA/MTA problems are you expecting to solve, that could not
be
solved in the service?

The VB6 is STA the service, as you point out is MTA. I tried
designating main as STAThread
You can't set the main thread to STA in a service, you need to create a
thread and initialize the thread to enter an STA before starting. You need
to create a thread that runs your service anyway (I hope this is done in
InitIndexer() !!!!)

and doing other MTA -STA tricks but the DLL continued to fail. The
only way we could get
the dog to hunt was by calling an external program within the service.
>VB6 project right, but is the exe a windows program or an ActiveX exe (
out-proc COM server)?

A windows program.
EEK, do you mean a program that displays a form?
>
>This is how the program is is getting started, which is not what I mean
with
"getting called". So I guess it's a simple standalone exe, which does not
expose methods that you can call from a client.

In this case, yes. It is just a simple program. It uses methods I have
access to by way
of the same DLLs.

>This is the confusing part, are you calling methods on this exe from your
service code?

I am not calling any methods on the exe in this instance. The exe is a
stand-alone
program that the service simply starts and watches for process
completion.
>As I said before, my guess is that this exe is stand-alone, in the sense
that it's getting *started* from within your service, but it's
functionality
is never called in terms of method calls from external clients (your
service).

That is correct.
>To resume, as far as I can see, this is what you have:
>A Windows Service (C#) that calls into native COM (VB6 dll's),

yes.
>The service starts an ( VB6 ) exe (conditional), that on it's turn calls
the
same COM objects as above.

yes.
>The service runs as LocalSystem, the VB6 exe runs in the same security
context as the service, that is it runs as a background program in the
LocalSystem account.

yes.
>There is no single component that explicitly interacts with the users
desktop.

Well, the DLLs provide methods that interact with the users desktop
but
the C# program is the one calling the methods and writing to the files
so,
I guess the answer that question is "correct".
Do you mean that the VB6 COM DLL's interact with the desktop, is the service
enabled to "interact with the desktop"? That would be really bad, these
DLL's run in the context of a Windows Service, and as such they should NOT
interact with the ineractive desktop, Services should never assume such
interactive desktop to be present. Note that this is no longer possible on
Vista.
Another point is that the VB6 program (the EXE) also runs in the security
context of a service, that means it has no access to the interactive desktop
either, so what are you expecting from a Windows program (the VB6 EXE) that
calls into UI like COM components that has no access to the visible desktop
..
>One components has a security issue when accessing a (disk) resource, and
logs this fact to the eventlog.

yes.
Question remains which component, "WindowsXYZServer.GetSpace() Access is
denied." should give you a clue isn't it?

Also, as a final note, I have been trying to register my DLLs on the
server with
regsvr32 and I keep getting failure due to "Entry Point Not Found".
Can you tell
me why I am getting this?
That means that the DLL's you are registering are NO COM DLL's, are you sure
you register the VB6 DLL's? Don't register the interop assemblies!!
Willy.
Jan 8 '08 #28

OK,

I now have access to the original projects for the DLLs.
It turns out the DLLs are all written in Visual C++. The
exe program i call in my project is VB6 (which calls these
DLLs).

Jan 8 '08 #29
On Jan 8, 2:25 pm, pbd22 <dush...@gmail.comwrote:
OK,

I now have access to the original projects for the DLLs.
It turns out the DLLs are all written in Visual C++. The
exe program i call in my project is VB6 (which calls these
DLLs).
Ben (and Willy):

OK, I just want to check,

I have the following folder path now:

/main

Interop.A.dll
Interop.B.dll
Interop.C.dll
windowsservice.exe

/bin
parser.exe

/lib
A.dll
B.dll
C.dll

I registered the DLLs in the /lib directory
and I simply included the Interop DLLs in the /Main
folder with the windowsservice.exe. Should I be
registering the Interop DLLs?

the VB6 program called inside my project is in
/bin.

Thanks,
Peter
Jan 8 '08 #30

OK... thanks guys.

I moved the COM DLLs to a new folder (thanks Ben) and the
Security problem went away. Not sure what exactly happened
but, hey, if it ain't broke...

I am getting one last log error:

Event Type: Error
Event Source: .NET Runtime 2.0 Error Reporting
Event Category: None
Event ID: 5000
Date: 1/8/2008
Time: 3:39:53 PM
User: N/A
Computer: 2003 Server
Description:
EventType clr20r3, P1 indexservice.exe, P2 1.0.0.0, P3 47827ce5, P4
indexservice, P5 1.0.0.0, P6 47827ce5, P7 b, P8 b3, P9
pszqoadhx1u5zahbhohghldgiy4qixhx, P10 NIL.

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 63 00 6c 00 72 00 32 00 c.l.r.2.
0008: 30 00 72 00 33 00 2c 00 0.r.3.,.
0010: 20 00 76 00 62 00 69 00 .v.b.i.
0018: 6e 00 64 00 65 00 78 00 n.d.e.x.
0020: 65 00 72 00 73 00 65 00 e.r.s.e.
0028: 72 00 76 00 69 00 63 00 r.v.i.c.
0030: 65 00 2e 00 65 00 78 00 e...e.x.
0038: 65 00 2c 00 20 00 31 00 e.,. .1.
0040: 2e 00 30 00 2e 00 30 00 ..0...0.
0048: 2e 00 30 00 2c 00 20 00 ..0.,. .
0050: 34 00 37 00 38 00 32 00 4.7.8.2.
0058: 37 00 63 00 65 00 35 00 7.c.e.5.
0060: 2c 00 20 00 76 00 62 00 ,. .v.b.
0068: 69 00 6e 00 64 00 65 00 i.n.d.e.
0070: 78 00 65 00 72 00 73 00 x.e.r.s.
0078: 65 00 72 00 76 00 69 00 e.r.v.i.
0080: 63 00 65 00 2c 00 20 00 c.e.,. .
0088: 31 00 2e 00 30 00 2e 00 1...0...
0090: 30 00 2e 00 30 00 2c 00 0...0.,.
0098: 20 00 34 00 37 00 38 00 .4.7.8.
00a0: 32 00 37 00 63 00 65 00 2.7.c.e.
00a8: 35 00 2c 00 20 00 62 00 5.,. .b.
00b0: 2c 00 20 00 62 00 33 00 ,. .b.3.
00b8: 2c 00 20 00 70 00 73 00 ,. .p.s.
00c0: 7a 00 71 00 6f 00 61 00 z.q.o.a.
00c8: 64 00 68 00 78 00 31 00 d.h.x.1.
00d0: 75 00 35 00 7a 00 61 00 u.5.z.a.
00d8: 68 00 62 00 68 00 6f 00 h.b.h.o.
00e0: 68 00 67 00 68 00 6c 00 h.g.h.l.
00e8: 64 00 67 00 69 00 79 00 d.g.i.y.
00f0: 34 00 71 00 69 00 78 00 4.q.i.x.
00f8: 68 00 78 00 20 00 4e 00 h.x. .N.
0100: 49 00 4c 00 0d 00 0a 00 I.L.....
Jan 8 '08 #31
ack. nevermind. old error is back - just delayed.
Jan 8 '08 #32
I also get "the process terminated unexpectedly" when I stop the
service.
Jan 8 '08 #33
using Debugging Tools for Win.
dump from tlist.exe for my running service:

3756 MyWindowsService.exe
CWD: C:\WINDOWS\system32\
CmdLine: "C:\Program Files\MyCompany\OurProduct\Common
\MyWindowsService\MyWindowsService.exe"
VirtualSize: 108144 KB PeakVirtualSize: 110192 KB
WorkingSetSize: 11136 KB PeakWorkingSetSize: 11144 KB
NumberOfThreads: 8
696 Win32StartAddr:0x79004010 LastErr:0x00000000 State:Waiting
1992 Win32StartAddr:0x79f0cdf0 LastErr:0x00000000 State:Waiting
3680 Win32StartAddr:0x79ed8df0 LastErr:0x00000000 State:Waiting
3888 Win32StartAddr:0x79ed8df0 LastErr:0x00000012 State:Waiting
3508 Win32StartAddr:0x79f669c2 LastErr:0x00000000 State:Waiting
3096 Win32StartAddr:0x79f56c12 LastErr:0x00000000 State:Waiting
1356 Win32StartAddr:0x77c7b0f5 LastErr:0x00000000 State:Waiting
3500 Win32StartAddr:0x776b16e4 LastErr:0x00000000 State:Waiting
1.0.0.0 shp 0x00400000 C:\Program Files\MyCompany\OurProduct
\Common\MyWindowsService\MyWindowsService.exe
5.2.3790.3959 shp 0x7C800000 C:\WINDOWS\system32\ntdll.dll
2.0.50727.832 shp 0x79000000 C:\WINDOWS\system32\mscoree.dll
5.2.3790.4062 shp 0x77E40000 C:\WINDOWS\system32\KERNEL32.dll
5.2.3790.3959 shp 0x77F50000 C:\WINDOWS\system32\ADVAPI32.dll
5.2.3790.4115 shp 0x77C50000 C:\WINDOWS\system32\RPCRT4.dll
5.2.3790.3959 shp 0x76F50000 C:\WINDOWS\system32\Secur32.dll
6.0.3790.3959 shp 0x77DA0000 C:\WINDOWS\system32\SHLWAPI.dll
5.2.3790.4033 shp 0x77C00000 C:\WINDOWS\system32\GDI32.dll
5.2.3790.4033 shp 0x77380000 C:\WINDOWS\system32\USER32.dll
7.0.3790.3959 shp 0x77BA0000 C:\WINDOWS\system32\msvcrt.dll
5.2.3790.3959 shp 0x76290000 C:\WINDOWS\system32\IMM32.DLL
2.0.50727.832 shp 0x79E70000 C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\mscorwks.dll
8.0.50727.762 shp 0x78130000 C:\WINDOWS\WinSxS
\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727 .762_x-
ww_6B128700\MSVCR80.dll
6.0.3790.4184 shp 0x7C8D0000 C:\WINDOWS\system32\shell32.dll
6.0.3790.3959 shp 0x77420000 C:\WINDOWS\WinSxS
\x86_Microsoft.Windows.Common-
Controls_6595b64144ccf1df_6.0.3790.3959_x-ww_D8713E55\comctl32.dll
2.0.50727.832 shp 0x790C0000 C:\WINDOWS\assembly
\NativeImages_v2.0.50727_32\mscorlib\3b740e4b052b9 6d82f4620aaf61a382b
\mscorlib.ni.dll
5.2.3790.3959 shp 0x77670000 C:\WINDOWS\system32\ole32.dll
2.0.50727.42 shp 0x67A20000 C:\WINDOWS\assembly\GAC_MSIL
\System.ServiceProcess\2.0.0.0__b03f5f7f11d50a3a
\System.ServiceProcess.dll
2.0.50727.832 shp 0x7A440000 C:\WINDOWS\assembly
\NativeImages_v2.0.50727_32\System
\1baaadbdde4f0dd4721ab9dc92d54ed6\System.ni.dll
2.0.50727.832 shp 0x79060000 C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\mscorjit.dll
2.0.50727.832 shp 0x637A0000 C:\WINDOWS\assembly
\NativeImages_v2.0.50727_32\System.Xml
\b66dbe55bb853af7ddcce37af39b96e4\System.Xml.ni.dl l
1.0.0.0 shp 0x00DE0000 C:\Program Files\MyCompany\OurProduct
\Common\MyWindowsService\Interop.VBWMParserLib.dll
8.0.50727.42 shp 0x5E410000 C:\WINDOWS\assembly
\NativeImages_v2.0.50727_32\Microsoft.VisualBas#
\1c64335e49ea77d310aa32519a45f17f\Microsoft.Visual Basic.ni.dll
2001.12.4720.3959 0x777B0000 C:\WINDOWS\system32\CLBCatQ.DLL
5.2.3790.4098 shp 0x77D00000 C:\WINDOWS\system32\OLEAUT32.dll
2001.12.4720.3959 0x77010000 C:\WINDOWS\system32\COMRes.dll
5.2.3790.3959 shp 0x77B90000 C:\WINDOWS\system32\VERSION.dll
5.2.3790.3959 shp 0x030D0000 C:\WINDOWS\system32\xpsp2res.dll
1.0.0.2 shp 0x10000000 C:\Program Files\MyCompany\OurProduct
\Common\MyWindowsService\lib\VBWMParser.dll
10.0.0.3997 shp 0x4EA20000 C:\WINDOWS\system32\WMVCore.DLL
10.0.0.4000 shp 0x58DD0000 C:\WINDOWS\system32\WMASF.DLL
5.2.3790.3959 shp 0x75DA0000 C:\WINDOWS\system32\SXS.DLL
6.0.3790.3959 shp 0x74540000 C:\WINDOWS\system32\mlang.dll
5.2.3790.3959 shp 0x76AA0000 C:\WINDOWS\system32\WINMM.dll
Jan 8 '08 #34
"pbd22" <du*****@gmail.comwrote in message
news:2a**********************************@k39g2000 hsf.googlegroups.com...
>
OK... thanks guys.

I moved the COM DLLs to a new folder (thanks Ben) and the
Security problem went away. Not sure what exactly happened
but, hey, if it ain't broke...
And did you un-registered the DLL's before moving, and re-registered after
moving? Guess not, that why you ain't have the security ssue, you aren't
getting at that point because the COM call succeeds.
You really seem like "shooting in the dark", you will shoot yourself I'm
affraid.
I am getting one last log error:

Event Type: Error
Event Source: .NET Runtime 2.0 Error Reporting
Event Category: None
Event ID: 5000
Date: 1/8/2008
Time: 3:39:53 PM
User: N/A
Computer: 2003 Server
Description:
EventType clr20r3, P1 indexservice.exe, P2 1.0.0.0, P3 47827ce5, P4
indexservice, P5 1.0.0.0, P6 47827ce5, P7 b, P8 b3, P9
pszqoadhx1u5zahbhohghldgiy4qixhx, P10 NIL.
This is logged automatically by the CLR because he encountered a "serious
runtime failure" in the indexservice.exe.

Willy.
Jan 8 '08 #35
"pbd22" <du*****@gmail.comwrote in message
news:6b**********************************@l32g2000 hse.googlegroups.com...
using Debugging Tools for Win.
dump from tlist.exe for my running service:

3756 MyWindowsService.exe
CWD: C:\WINDOWS\system32\
CmdLine: "C:\Program Files\MyCompany\OurProduct\Common
\MyWindowsService\MyWindowsService.exe"
VirtualSize: 108144 KB PeakVirtualSize: 110192 KB
WorkingSetSize: 11136 KB PeakWorkingSetSize: 11144 KB
NumberOfThreads: 8
696 Win32StartAddr:0x79004010 LastErr:0x00000000 State:Waiting
1992 Win32StartAddr:0x79f0cdf0 LastErr:0x00000000 State:Waiting
3680 Win32StartAddr:0x79ed8df0 LastErr:0x00000000 State:Waiting
3888 Win32StartAddr:0x79ed8df0 LastErr:0x00000012 State:Waiting
3508 Win32StartAddr:0x79f669c2 LastErr:0x00000000 State:Waiting
3096 Win32StartAddr:0x79f56c12 LastErr:0x00000000 State:Waiting
1356 Win32StartAddr:0x77c7b0f5 LastErr:0x00000000 State:Waiting
3500 Win32StartAddr:0x776b16e4 LastErr:0x00000000 State:Waiting
1.0.0.0 shp 0x00400000 C:\Program Files\MyCompany\OurProduct
\Common\MyWindowsService\MyWindowsService.exe
5.2.3790.3959 shp 0x7C800000 C:\WINDOWS\system32\ntdll.dll
2.0.50727.832 shp 0x79000000 C:\WINDOWS\system32\mscoree.dll
5.2.3790.4062 shp 0x77E40000 C:\WINDOWS\system32\KERNEL32.dll
5.2.3790.3959 shp 0x77F50000 C:\WINDOWS\system32\ADVAPI32.dll
5.2.3790.4115 shp 0x77C50000 C:\WINDOWS\system32\RPCRT4.dll
5.2.3790.3959 shp 0x76F50000 C:\WINDOWS\system32\Secur32.dll
6.0.3790.3959 shp 0x77DA0000 C:\WINDOWS\system32\SHLWAPI.dll
5.2.3790.4033 shp 0x77C00000 C:\WINDOWS\system32\GDI32.dll
5.2.3790.4033 shp 0x77380000 C:\WINDOWS\system32\USER32.dll
7.0.3790.3959 shp 0x77BA0000 C:\WINDOWS\system32\msvcrt.dll
5.2.3790.3959 shp 0x76290000 C:\WINDOWS\system32\IMM32.DLL
2.0.50727.832 shp 0x79E70000 C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\mscorwks.dll
8.0.50727.762 shp 0x78130000 C:\WINDOWS\WinSxS
\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727 .762_x-
ww_6B128700\MSVCR80.dll
6.0.3790.4184 shp 0x7C8D0000 C:\WINDOWS\system32\shell32.dll
6.0.3790.3959 shp 0x77420000 C:\WINDOWS\WinSxS
\x86_Microsoft.Windows.Common-
Controls_6595b64144ccf1df_6.0.3790.3959_x-ww_D8713E55\comctl32.dll
2.0.50727.832 shp 0x790C0000 C:\WINDOWS\assembly
\NativeImages_v2.0.50727_32\mscorlib\3b740e4b052b9 6d82f4620aaf61a382b
\mscorlib.ni.dll
5.2.3790.3959 shp 0x77670000 C:\WINDOWS\system32\ole32.dll
2.0.50727.42 shp 0x67A20000 C:\WINDOWS\assembly\GAC_MSIL
\System.ServiceProcess\2.0.0.0__b03f5f7f11d50a3a
\System.ServiceProcess.dll
2.0.50727.832 shp 0x7A440000 C:\WINDOWS\assembly
\NativeImages_v2.0.50727_32\System
\1baaadbdde4f0dd4721ab9dc92d54ed6\System.ni.dll
2.0.50727.832 shp 0x79060000 C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\mscorjit.dll
2.0.50727.832 shp 0x637A0000 C:\WINDOWS\assembly
\NativeImages_v2.0.50727_32\System.Xml
\b66dbe55bb853af7ddcce37af39b96e4\System.Xml.ni.dl l
1.0.0.0 shp 0x00DE0000 C:\Program Files\MyCompany\OurProduct
\Common\MyWindowsService\Interop.VBWMParserLib.dll
8.0.50727.42 shp 0x5E410000 C:\WINDOWS\assembly
\NativeImages_v2.0.50727_32\Microsoft.VisualBas#
\1c64335e49ea77d310aa32519a45f17f\Microsoft.Visual Basic.ni.dll
2001.12.4720.3959 0x777B0000 C:\WINDOWS\system32\CLBCatQ.DLL
5.2.3790.4098 shp 0x77D00000 C:\WINDOWS\system32\OLEAUT32.dll
2001.12.4720.3959 0x77010000 C:\WINDOWS\system32\COMRes.dll
5.2.3790.3959 shp 0x77B90000 C:\WINDOWS\system32\VERSION.dll
5.2.3790.3959 shp 0x030D0000 C:\WINDOWS\system32\xpsp2res.dll
1.0.0.2 shp 0x10000000 C:\Program Files\MyCompany\OurProduct
\Common\MyWindowsService\lib\VBWMParser.dll
10.0.0.3997 shp 0x4EA20000 C:\WINDOWS\system32\WMVCore.DLL
10.0.0.4000 shp 0x58DD0000 C:\WINDOWS\system32\WMASF.DLL
5.2.3790.3959 shp 0x75DA0000 C:\WINDOWS\system32\SXS.DLL
6.0.3790.3959 shp 0x74540000 C:\WINDOWS\system32\mlang.dll
5.2.3790.3959 shp 0x76AA0000 C:\WINDOWS\system32\WINMM.dll


Could you please tell us what you are trying to tell us with all this?

Willy.

Jan 8 '08 #36
Sorry. I think its late and I am grabbing.
Most would have given up on me by now - thanks for hanging in there.

I want to answer your original question - where is the error coming
from???

I have finally found the .cs file that is responsible for the method:
/// <summary>
/// Get free disk space information for the specified drive on
the server
/// </summary>
/// <param name="xDrive">Drive letter</param>
/// <returns>Free disk space in GB. It returns float.MaxValue
if it fails to get the info from the server for any reason</returns>
override public float GetDiskSpace(char xDrive)
{
return HelperClass.GetDiskSpace(Capabilities, Address,
Name, Password, xDrive);
}

I am not sure, though, where to go from here.

Thanks again.
Jan 9 '08 #37
Many posts ago you wrote:

WindowsXYZServer.GetSpace() Access is denied. (Exception from HRESULT:
0x80070005 (E_ACCESSDENIED))

and now,

override public float GetDiskSpace(char xDrive)
{
return HelperClass.GetDiskSpace(Capabilities, Address,Name, Password,
xDrive);
}
So the presumption is that the username (a guess at what "Name" is) and
Password do not allow permission to the drive being refered to in the call,
if they are even valid for the new computer. It should be straightforward to
find all the values and verify them.
Jan 9 '08 #38


Yes, this was my instinct also.
As for "straightforward" - well, maybe for you :)

Jan 9 '08 #39
"pbd22" <du*****@gmail.comwrote in message
news:d6**********************************@i12g2000 prf.googlegroups.com...
Sorry. I think its late and I am grabbing.
Most would have given up on me by now - thanks for hanging in there.

I want to answer your original question - where is the error coming
from???

I have finally found the .cs file that is responsible for the method:
/// <summary>
/// Get free disk space information for the specified drive on
the server
/// </summary>
/// <param name="xDrive">Drive letter</param>
/// <returns>Free disk space in GB. It returns float.MaxValue
if it fails to get the info from the server for any reason</returns>
override public float GetDiskSpace(char xDrive)
{
return HelperClass.GetDiskSpace(Capabilities, Address,
Name, Password, xDrive);
}

I am not sure, though, where to go from here.

Thanks again.


Search for the HelperClass and inspect the GetDiskSpace method, this is the
one that probably logs the error message(if it doesn't call another method).
You should also look at the Name and Password arguments, where do they come
from what do they hold and what are they used for.
If they are used to impersonate a user, then you should check whether there
exists a user with these credentials.

Willy.
Jan 9 '08 #40
Thanks a ton Willy (and everybody else).
I know know what the problem is. The solution
is a bit more complicated but, at least I am on
the right trail now.

Thanks!
Jan 9 '08 #41
OK.

The solution to the GetDiskSpace problem was strange (it had to do
with how our product
is set up to access different types of file servers) but it is
resolved.

Willy, per your earlier advice, I have some more questions.

You said that I may have problems with running a standard exe program
from a windows service.

I am noticing that the exe works just fine when called from DOS. It
"""also""" works OK when
I am running my window service in Debug mode from Visual Studio 2005.
But, when I wire up
the service using InstallUtil and load it on the server (or even on my
development desktop) and
start it, the exe program doesn't seem to work.

The exe program is a VB6 program.
It takes a video file and extracts metadata, writing to a text file.
It is dependent on its own DLLs (which are also called by my
service).
It runs for about 1 or 2 seconds to do its think.
The service uses locks and queues to make sure the process does
not block.

Why would the exe work in Debug mode but not once the Release
is installed as a windows service???

Thanks again
Peter
Jan 10 '08 #42

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.