Solved

Not able to start windows service written in vb.net

Posted on 2003-10-22
7
192 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
ID: 9602099
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
ID: 9602230
I have tried with administrator acct but getting the same error.

0
 
LVL 19

Accepted Solution

by:
Desp earned 500 total points
ID: 9602299
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:gubbalasree
ID: 9602361
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
ID: 9610302
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
ID: 10319276
Recommendation: Delete/Not refund
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java Loop 6 73
Please help| Getting the syntax error in below query. 2 70
T-SQL:  Sigh---Boy, this is fun.... 12 67
ejb wildfly example 2 70
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
In this post we will learn different types of Android Layout and some basics of an Android App.
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

713 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