×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

running service from command line

running service from command line

running service from command line

(OP)
Hello,

I have a service programmed in VS that compiles as a dll. To run the service, I need to open VS and run it. Is there a way to run my dll from the command line (i.e. without having to open VS)?

RE: running service from command line

Gib,
You need to build a console app to actually execute your code.

You've got questions and source code. We want both!
Here at tek tips, we provide a hand up, not a hand out.

RE: running service from command line

It sounds like what you want to do svchost.exe will do for you but I do not see an easy way to hook your dll onto svchost, but i did come across article that may help you.

http://social.msdn.microsoft.com/Forums/en-US/netf...

Scroll to the bottom to see one developers take.

RE: running service from command line

(OP)

Quote (Qik3Coder)

Gib,
You need to build a console app to actually execute your code.
That's actually what I want to do in the end.

I've recently learnt how to use

System.Diagnostics.Process.Start(pathToExe)

This works on exe's of course, not dlls, but I'm thinking there must be a similar way to run dlls. I know VS does it (when I hit F5) so why can't it be done from a command line. If I can figure that out, maybe I can take that command and pass it into

System.Diagnostics.Process.Start(command)

It will probably require a bit of tweeking since it's not exactly an executable (not necessarily) but I'm sure there must be a way to do it along these lines.

Quote (ralphtrent)


It sounds like what you want to do svchost.exe will do for you but I do not see an easy way to hook your dll onto svchost, but i did come across article that may help you.

http://social.msdn.microsoft.com/Forums/en-US/netf...

Scroll to the bottom to see one developers take.

Thanks for the link. They seem to be talking about something that requires you to "install" the service (into Window's registry, I presume). I looked up installing services the other day and came across this utility:

regsvr32

From what I read, if you put your dll in Windows/System32 and cd to that directory, then type "regsvr32 yourservice.dll", it should install it.

But when I try it, it tells me

Quote (regsvr32)


The module "yourservice.dll" was loaded but the entry-point DllRegisterServer was not found. Make sure that "yourservice.dll" is a valid DLL or OCX file and then try again.

Now, I don't mind modifying the source code to give it the entry-point DllRegisterServer (is that like Main?) but I'd rather not modify anything since it's not really my code (it belongs to the company and is under version control), so I'd prefer to use some alternate way of accomplishing my goal (if there is one). If there is no alternative, just let me know and I'll persue making it insatllable by this means. Thanks.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close