Solved

Not able to start windows service written in vb.net

Posted on 2003-10-22
7
191 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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
eclipse package explorer vs project explorer view 2 172
how to update exe applicatio from internet ? 6 86
Selenium and Interactive Data Language 3 42
Help Required 3 107
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.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.

809 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