Click here to Skip to main content
15,914,165 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Performance Pin
User 66589-Jan-06 4:10
User 66589-Jan-06 4:10 
GeneralRe: C# Performance Pin
Dave Kreskowiak9-Jan-06 5:43
mveDave Kreskowiak9-Jan-06 5:43 
QuestionInvoking GUI Pin
rnvrnv8-Jan-06 22:48
rnvrnv8-Jan-06 22:48 
AnswerRe: Invoking GUI Pin
ika28-Jan-06 22:57
ika28-Jan-06 22:57 
AnswerRe: Invoking GUI Pin
krieg388-Jan-06 23:00
krieg388-Jan-06 23:00 
GeneralRe: Invoking GUI Pin
rnvrnv8-Jan-06 23:05
rnvrnv8-Jan-06 23:05 
QuestionBinding Dataset with textboxes Pin
hellamasta8-Jan-06 22:00
hellamasta8-Jan-06 22:00 
QuestionService will not start Pin
spif20018-Jan-06 21:21
spif20018-Jan-06 21:21 
Why can't I install and start a service using the following code?

<br />
private void Test()<br />
{<br />
    try<br />
    {<br />
        Process p = Process.Start(@"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\regsvcs", @"/fc C:\My.dll");<br />
        p.WaitForExit();<br />
        if(p.ExitCode != 0)<br />
        {                   <br />
            Console.WriteLine("My service install(RegSvcs) failed!!!");<br />
            Console.WriteLine("ExitCode was: "+p.ExitCode);<br />
            return;<br />
        }<br />
        ServiceController sc = new ServiceController("My",Environment.MachineName);<br />
        sc.Start();<br />
        Console.WriteLine("My service started!");<br />
    }<br />
    catch(Exception ex)<br />
    {<br />
        Console.WriteLine("Install failed - Exception!!!");<br />
        Console.WriteLine(ex.ToString());<br />
    }<br />
}<br />


RegSvcs works fine and the service places itself in the COM+ services (I can see it via the ServiceComponents app), but when the code reaches sc.Start(), it throws an Exception with the following information:

System.InvalidOperationException.
Service My was not found on computer 'MBU'.

InnerException = System.ComponentModel.Win32Exception
(Danish)Den angivne tjeneste findes ikke som en installeret tjeneste
(Translated)The service does not exists as an installed service

Has it something to do with the service being a DLL and not an EXE and therefore you can't start it with a ServiceController?

I can start it manually, by using the Componentservices app and right click on the "My" service.

That means the service works, but just can't be started by the above shown code.

What is going on?
AnswerRe: Service will not start Pin
krieg388-Jan-06 23:52
krieg388-Jan-06 23:52 
GeneralRe: Service will not start Pin
spif20019-Jan-06 0:18
spif20019-Jan-06 0:18 
GeneralRe: Service will not start Pin
spif20019-Jan-06 3:57
spif20019-Jan-06 3:57 
QuestionCalling Operator Pin
rooz72008-Jan-06 19:49
rooz72008-Jan-06 19:49 
AnswerRe: Calling Operator Pin
Sebastian Schneider8-Jan-06 20:02
Sebastian Schneider8-Jan-06 20:02 
QuestionContext Menu& TreeView Pin
krieg388-Jan-06 18:11
krieg388-Jan-06 18:11 
AnswerRe: Context Menu&amp;amp; TreeView Pin
tarasn8-Jan-06 21:13
tarasn8-Jan-06 21:13 
AnswerRe: Context Menu& TreeView Pin
S. Senthil Kumar8-Jan-06 21:14
S. Senthil Kumar8-Jan-06 21:14 
GeneralRe: Context Menu& TreeView Pin
krieg388-Jan-06 22:00
krieg388-Jan-06 22:00 
Questioncan we use .net dlls in win32 applicatiuons Pin
abyclassic8-Jan-06 18:03
abyclassic8-Jan-06 18:03 
AnswerRe: can we use .net dlls in win32 applicatiuons Pin
spif20018-Jan-06 21:31
spif20018-Jan-06 21:31 
GeneralRe: can we use .net dlls in win32 applicatiuons Pin
Dave Kreskowiak9-Jan-06 3:23
mveDave Kreskowiak9-Jan-06 3:23 
AnswerRe: can we use .net dlls in win32 applicatiuons Pin
Dave Kreskowiak9-Jan-06 3:21
mveDave Kreskowiak9-Jan-06 3:21 
GeneralRe: can we use .net dlls in win32 applicatiuons Pin
abyclassic10-Jan-06 19:07
abyclassic10-Jan-06 19:07 
GeneralRe: can we use .net dlls in win32 applicatiuons Pin
Dave Kreskowiak11-Jan-06 1:05
mveDave Kreskowiak11-Jan-06 1:05 
QuestionRun other applications within my application Pin
AesopTurtle8-Jan-06 14:19
AesopTurtle8-Jan-06 14:19 
AnswerRe: Run other applications within my application Pin
Dave Kreskowiak8-Jan-06 15:44
mveDave Kreskowiak8-Jan-06 15:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.