Unable to start windows service

Developing a c# webservices in sharpDevelop tool but getting error message
"Cannot start service from the command line or debugger. A winwows Service must first be installed(using installutil.exe) and then started with the ServerExplorer, Windows Services Afministrative tool or the NET START command."
Bharpinder SinghDeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chinmay PatelChief Technical NinjaCommented:
Are you developing a Windows Service or a Web Service?

If it is a Windows Service, follow this step by step guide: https://docs.microsoft.com/en-us/dotnet/framework/windows-services/how-to-install-and-uninstall-services

Or launch Developer Command Prompt and use the following command

installutil <yourproject>.exe  

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bharpinder SinghDeveloperAuthor Commented:
Sorry its windows service
Chinmay PatelChief Technical NinjaCommented:
Yupp then follow the guidance provided above. As you mentioned the error I thought it has to be a Windows Service - I asked 'cause some scenarios require you to host a WCF Service using a Windows Service so thought I will double check.
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

Bharpinder SinghDeveloperAuthor Commented:
actually, i am not expert in c# i just started to make a utility with sharpDevelop tool.
I think with installutil  command , we need installutil.exe installed on every system where i will execute my script. right?
i want any solution by which user have not to be install any extra software to run my code.
Bharpinder SinghDeveloperAuthor Commented:
there are many software like antivirus whose windows service installed without any dependance (like installutil)
Chinmay PatelChief Technical NinjaCommented:
No. That is why I always strongly recommend learning things in a right way. You can take liberty of skipping topics once you have gained better insights in a given topic. C# is good but it is better to first understand .Net Framework why it exists, what it does and how it works.

Anyways to answer your concern, InstallUtil is a part of .net framework so any code that you write in C# is going to need .Net Framework and hence it will have InstallUtil available to you. Also, you will build an installer to deploy your components - if not a batch script that will take care of installation.
Chinmay PatelChief Technical NinjaCommented:
No you are wrong again. There is not a single software that will be able to install without any dependency - I can bet my life on that. Everything depends on something. The softwares you are mentioning does install dependencies behind the scenes. Just because you do not see things happening in action does not mean they are not happening. I think I am wrong to suggest understanding .net Framework in my above comment, you should start from very basics. Maybe Operating System fundamentals (It still depends on your requirements but that's my suggestion - understand the fundamentals - other things will be EASY).
Bharpinder SinghDeveloperAuthor Commented:
Ok, I got it.
I am web developer but new in windows scripting.
I just want to make a script which can read usb device on plugin and popup one message.
So i decided to do by self instead of hiring any experts.
Chinmay PatelChief Technical NinjaCommented:
That is how mostly even I like to do things. My suggestion on this approach- Keep the mind open for possibilities(Both Good and Bad) and
do some homework on the tech you are aiming.

Also I was wondering, if you need to detect a cam on client's machine how about using built-in HTML5 features or fall-back to Flash plugin?
I don't know your exact requirements but it is worth checking.
Bharpinder SinghDeveloperAuthor Commented:
The requirement is not related to web or html.
It should work without opening borwser.
Here is actual task i have:
1) Install .exe file into the system
2) Windows service automatically starts and check USB webcam for plugin or unplug
3) Every event writes a log file or popup a custom message.

Your suggestion will be very helpful.
Chinmay PatelChief Technical NinjaCommented:
Yupp. These are definitely a Windows Service requirements. You have made a good call by choosing Windows Service.
Now, don't worry about the installation that we will automate by script or installer - as long as user agrees to execute it we will be ok.
Let me know once you are able to install and start the service.
Bharpinder SinghDeveloperAuthor Commented:
now system required .Net Framework to run c# script.
Chinmay PatelChief Technical NinjaCommented:
Yupp. As I mentioned earlier compatible version of. Net will be needed. Can you tell me which O/S you are targeting?
Bharpinder SinghDeveloperAuthor Commented:
Normally xp and windows 7
Chinmay PatelChief Technical NinjaCommented:
Supporting XP is not possible and I will suggest to avoid XP at all cost - it does not matter if it was the best thing that happened to the world around 17 years back but the O/S is not supported hence getting results on Windows XP will be a big challenge.

Windows 7 is a different story it is in extended support mode till 2020 so we are ok till then.

Now to avoid these challenges of having proper dependencies and their installation I suggest you build an installer for your solution. There are many free such installation solutions available (For example, InnoSetup, Nullsoft Installation System).
Bharpinder SinghDeveloperAuthor Commented:
still running one question in mind.
My system doesn't have .NET framework and installed one application named 'USB disk security'
it popup on USB plugin to scan.
Question is in which language/framework it developed ?
It has windows service too..
Chinmay PatelChief Technical NinjaCommented:
Mostly VC++
Shaun VermaakTechnical SpecialistCommented:
And even then you need VC++ runtime redistributable package. Why the concern about installing a runtime?
Chinmay PatelChief Technical NinjaCommented:
Author has not responded in a while but the answer to his original question is posted. If author needs more information I am happy to help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.