473,386 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ASP.NET + WindowsServices

Hello,

I would like to access to Windows Service via ASP.NET. I have written
very simple web application which starts and stops windows service. Here
is my StarButton event:

private void StartButton_Click(object sender, System.EventArgs e)
{
ServiceController sc = new ServiceController();
sc.ServiceName = "MyService";
sc.Start();
}

When I try to start Windows Service I receive the following error:
System.ComponentModel.Win32Exception: Access is denied.

How to set up my web application or my Windows Service to have a
perrmission to stoping or starting Windows Service via ASP.NET. I'm
newbie in Windows Services and I would ask You for help.
Thank You in advance.

Andy
Nov 19 '05 #1
4 1351
1. The account ASP.NET runs under needs permissions to start/stop the service. Just add it to Admin group.
2. did you write the service "MyService" itself?
3. Why do you need to start/stop service from ASP.NET. The service usually starts automatically when windows starts.
George

"Andy" <-s******************@wp.pl> wrote in message news:dh**********@atlantis.news.tpi.pl...
Hello,

I would like to access to Windows Service via ASP.NET. I have written
very simple web application which starts and stops windows service. Here
is my StarButton event:

private void StartButton_Click(object sender, System.EventArgs e)
{
ServiceController sc = new ServiceController();
sc.ServiceName = "MyService";
sc.Start();
}

When I try to start Windows Service I receive the following error:
System.ComponentModel.Win32Exception: Access is denied.

How to set up my web application or my Windows Service to have a
perrmission to stoping or starting Windows Service via ASP.NET. I'm
newbie in Windows Services and I would ask You for help.
Thank You in advance.

Andy
Nov 19 '05 #2
Andy,

Well, for starting/stopping services you'll need the Administrator
rights. Haven't tried it myself but hey, it are the organs of your
Windows OS ;)

Cheers,
//Rutger

http://www.RutgerSmit.com

Andy wrote:
Hello,

I would like to access to Windows Service via ASP.NET. I have written
very simple web application which starts and stops windows service. Here
is my StarButton event:

private void StartButton_Click(object sender, System.EventArgs e)
{
ServiceController sc = new ServiceController();
sc.ServiceName = "MyService";
sc.Start();
}

When I try to start Windows Service I receive the following error:
System.ComponentModel.Win32Exception: Access is denied.

How to set up my web application or my Windows Service to have a
perrmission to stoping or starting Windows Service via ASP.NET. I'm
newbie in Windows Services and I would ask You for help.
Thank You in advance.

Andy

Nov 19 '05 #3
George wrote:
1. The account ASP.NET runs under needs permissions to start/stop the
service. Just add it to Admin group.
2. did you write the service "MyService" itself? Yes.
3. Why do you need to start/stop service from ASP.NET. The service
usually starts automatically when windows starts.

I will write in the future the specific web application that will
controll one of the windows services
Nov 19 '05 #4
George wrote:
1. The account ASP.NET runs under needs permissions to start/stop the
service. Just add it to Admin group.


There isn't the other solution ? I don't want that ASPNET runs under
Admin permission. It may be dengerous.
Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Benito Ruiz | last post by:
Hello all, I´m searching information about how development .Net Web Parts for SharePoint Portal Server 2003. Where i can found it?? Thank´s a lot.
1
by: Daylor | last post by:
hi. i have application with 2 appdomain , and 2 threads (win32 threads(not logical threads)). i want to call the "remote" object on the second appdomain in async way, so the method will execute...
5
by: CG | last post by:
Hi I have developed a Windows Service When I try to start the Service it tells me that it cannot start as there may not be any work to do When I comment out below line of code in my OnStart...
1
by: sda | last post by:
Bonjour, Est-ce que vous connaissez des liens qui feraient part d'un retour d'expérience concernant l'utilisation d'ADAM comme annuaire d'un site WSS ? Merci Cdt, SDA
3
by: Burns | last post by:
Hi I'm trying to write a service. It's a pretty simple thing at the moment that just writes to the EventLog, just so I can get my head around the basics of writing Services. It's compiled fine...
5
by: Ann Marinas | last post by:
Hi, All! I would like to ask you guys if ever you have any technical resources on Windows Services... I am a new to this concept, and currently developing a program that would import files,...
2
by: Chris Kane | last post by:
We have written a class that enumerates the items in a WSS list and then attemptes to open the attachment for each item. We have written two classes, one to impersonate a user and read in the list...
0
by: Seth Thibodeaux | last post by:
I have built a Windows Service that connects to Sql Server 2000 Reporting Services via its Web Service interface for the purpose of generating reports. Intermittently, calls made to the Web Service...
2
by: =?Utf-8?B?S2plbGw=?= | last post by:
Is this the tight place for Sharepoint issues? for example SharePoint Services 3.0 Kjell
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.