Solved

Not able to start windows service written in vb.net

Posted on 2003-10-22
7
194 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

739 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