File and 'Windows Service' access from Web Application

From: Cash Foley (news_at_cashfoley.com)
Date: 07/30/03

  • Next message: Michel Gallant: "Re: How to get the private key from the certificate using .net"
    Date: Wed, 30 Jul 2003 10:16:57 -0700
    
    

    I'm trying to start a Web Service from a Web Application
    running on 2003 Server. The following code works fine
    when run from a Windows Application but I get an Access
    Denied exception when I attempt to run it from my Web App.

    ServiceController[] services =
    ServiceController.GetServices();

    foreach(ServiceController service in services)
    {
        if(service.ServiceName == "ServiceName")
        {
            if(service.Status ==
    ServiceControllerStatus.Stopped)
            {
                service.Start();
            }
        }
    }

    Similarly, I'm getting an Access Denied when streaming a
    Text File with

    using( StreamWriter writer = new StreamWriter(
    configFile ) )
    {
        writer.Write("Some Text" );
    }

    Can anyone help me with this?

    Thanks in advance,

    Cash Foley


  • Next message: Michel Gallant: "Re: How to get the private key from the certificate using .net"

    Relevant Pages

    • Socket server error.
      ... i have the following simple Socket Server code and a vb client that send to ... The string is succesfully sent to the server but not the reverse when the ... StreamWriter streamWriter = new ...
      (microsoft.public.dotnet.languages.csharp)
    • unable to read data from the transport connection
      ... I have the following code running against the compact framework: ... String body = ... StreamWriter stream = new ... because the server does receive the ...
      (microsoft.public.dotnet.languages.csharp)
    • Help to solve error while reading a file?
      ... I have made an ASP.NET 1.1 application on windows 2000 advanced server. ... StreamWriter sr=new StreamWriter; ...
      (microsoft.public.dotnet.framework.aspnet)
    • Help required, problems while reading in a file??( REPOST)
      ... I have made an ASP.NET 1.1 application on windows 2000 advanced server. ... StreamWriter sr=new StreamWriter; ...
      (microsoft.public.dotnet.framework.aspnet)
    • Help Required( Repost)
      ... I have made an ASP.NET 1.1 application on windows 2000 advanced server. ... StreamWriter sr=new StreamWriter; ...
      (microsoft.public.dotnet.framework.aspnet)