Solved

Not able to start windows service written in vb.net

Posted on 2003-10-22
7
187 Views
Last Modified: 2010-04-17
Hi All,
        I have written windows service in vb.net that will read the registry entires from Current User. Code was working fine on windows application but same code is not working while trying to start the service. Its giving the following error

Could not start the FileConverter(name of my service) service on Local computer.
The service did not return an error. This could be an internal windows error or an internal service error. If the problem persists, contact your system administrator.

Here is my code:

Imports System.ServiceProcess
Imports System.IO
Imports Microsoft.Win32
Imports System.Security.Permissions

<Assembly: RegistryPermissionAttribute(SecurityAction.RequestMinimum, All:="HKEY_CURRENT_USER")>


Protected Sub InitializeService()

        Dim rk As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\VB and VBA Program Settings\File Convertor\Inbox", False)
        Dim cnt As Int32

        cnt = rk.GetValue("Source") ' Source is the value under Inbox  key
End Sub

Thanks in advance

Srinivas


0
Comment
Question by:gubbalasree
7 Comments
 
LVL 9

Expert Comment

by:tinchos
Comment Utility
are you trying to start it using an administrator account?
(I believe that you need full permits in order to start a service)
0
 

Author Comment

by:gubbalasree
Comment Utility
I have tried with administrator acct but getting the same error.

0
 
LVL 19

Accepted Solution

by:
Desp earned 500 total points
Comment Utility
Software\VB and VBA Program Settings\File Convertor\Inbox

this key exits??

also debug yur service with some error log mechanism or use text files to write the proceedings of your service

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:gubbalasree
Comment Utility
Hi Desp that key exists in the registry and if the service starts then i can debug by attaching the process to the debugger.

If i remove the registry access code then the service is starting and i m able to debug by attaching to the debugger.




       
0
 
LVL 6

Expert Comment

by:zrh
Comment Utility
You can try getting the permissions imperatively.
Put the following as first lines of InitializeService():

Dim f As New RegistryPermission(RegistryPermissionAccess.Read, "HKEY_CURRENT_USER\Software\VB and VBA Program Settings\File Convertor\Inbox")

Are you sure this is where your error is coming from?
Have you tried hardcoding a value instead of reading from registry? Did it work?

Hope this helps some,
ZRH
0
 
LVL 19

Expert Comment

by:Desp
Comment Utility
Recommendation: Delete/Not refund
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article will show, step by step, how to integrate R code into a R Sweave document
A short article about a problem I had getting the GPS LocationListener working.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now