473,383 Members | 1,837 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,383 software developers and data experts.

Remote Application Restart

Hello,

I have a reasonable amount of VB.net knowledge but my ASP.net skills
are in their infancy. I want to create what I assumed was not an
uncommon task that I could not accomplish in VB.net. I am attempting to
create an application that will enable me to stop and restart an
application on a remote machine. After taking the "VB.Net" approach in
an ASP.net page it became apperant that a little more is involved. I
can return a list of processes, but when I attempt to process.kill or
process.closemainwindow an exception is thrown. Note that this is
server side code, and the application I want to "kill" is on the
server. I have tried fiddling around with security..i.e. enabling
impersonation etc. to no avail.

After searching through a few threads here it appears as though ASP.net
simply cannot accomodate this functionality. And rather one should use
a web service to accomplish this.

Enough rambling...to my questions: Is it true that there is no way to
remotly restart an application with a simple ASP.net app?

If a web service is the answer does anyone know of a simple example as
I can only get web services to return values rather than perform tasks
(I have no experience here...)?

Thanks for your help!
Jeremy

Nov 19 '05 #1
3 3101
Hi Jeremy:

A web service has the same limitations as a WebForms application, and
runs under the same account. I still believe you face a security
barrier - what is the error message from the exception?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 26 Apr 2005 15:03:41 -0700, "Jeremy" <sl********@hotmail.com>
wrote:
Hello,

I have a reasonable amount of VB.net knowledge but my ASP.net skills
are in their infancy. I want to create what I assumed was not an
uncommon task that I could not accomplish in VB.net. I am attempting to
create an application that will enable me to stop and restart an
application on a remote machine. After taking the "VB.Net" approach in
an ASP.net page it became apperant that a little more is involved. I
can return a list of processes, but when I attempt to process.kill or
process.closemainwindow an exception is thrown. Note that this is
server side code, and the application I want to "kill" is on the
server. I have tried fiddling around with security..i.e. enabling
impersonation etc. to no avail.

After searching through a few threads here it appears as though ASP.net
simply cannot accomodate this functionality. And rather one should use
a web service to accomplish this.

Enough rambling...to my questions: Is it true that there is no way to
remotly restart an application with a simple ASP.net app?

If a web service is the answer does anyone know of a simple example as
I can only get web services to return values rather than perform tasks
(I have no experience here...)?

Thanks for your help!
Jeremy


Nov 19 '05 #2
Hey Scott,

Thanks for helping out.

The following simple code...

For Each ps In ps.GetProcesses
lstApps.Items.Add(ps.ProcessName)
If ps.ProcessName = "notepad" Then
ps.Kill()
End If
Next

The process.kill statement generates the following exception:

ACCESS DENIED

System.ComponentModel.Win32Exception: Access is denied

What can I do to kill a process on the active desktop? I realize the
ASP.net user account has limited privilages and I have tried
impersonation...no effect.

Thanks again for your help.

Jeremy

Nov 19 '05 #3
I did a little test and couldn't kill a process even when
impersonating a user, however, if I ran the process as the Local
System account (by changing machine.config) the code would kill the
process. It appears the impersonated identity isn't used when trying
to kill.

Running asp.net under the system account isn't a great idea, though,
so perhaps a better idea would be to spawn a process like kill.exe
under an admin account if you really need to do this.

See:

How to spawn a process that runs under the context of the impersonated
user in Microsoft ASP.NET pages
http://support.microsoft.com/default...b;EN-US;889251

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 27 Apr 2005 20:20:54 -0700, "Jeremy" <sl********@hotmail.com>
wrote:
Hey Scott,

Thanks for helping out.

The following simple code...

For Each ps In ps.GetProcesses
lstApps.Items.Add(ps.ProcessName)
If ps.ProcessName = "notepad" Then
ps.Kill()
End If
Next

The process.kill statement generates the following exception:

ACCESS DENIED

System.ComponentModel.Win32Exception: Access is denied

What can I do to kill a process on the active desktop? I realize the
ASP.net user account has limited privilages and I have tried
impersonation...no effect.

Thanks again for your help.

Jeremy


Nov 19 '05 #4

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

Similar topics

2
by: Daniel | last post by:
when i use stream writer to write to a shared folder, and the network card of that remote computer is disabled in the middle of the write then reenabled later. every time i try to write to that...
2
by: felecha | last post by:
I'm stumped. I'm working on an application in VB.Net that uses System.Messaging.MessageQueue to listen for messages sent to a private queue on a remote machine. Both machines are in the same...
1
by: Jeremy | last post by:
I have a program that returns a list of processes running on a remote machine. For the most part it works fine, but if the application is a VB6 app it returns an exception: "Feature is not...
3
by: lk | last post by:
I need some help regarding the mechanism to put in place to be able to dynamically update a remote object when the assembly where it is defined is modified, and this whitout having service...
3
by: btysgtmajor | last post by:
Hi all, I'm running a Win2003 server w/ IIS 6. The home directory of the website is on a network share. I successfully host html pages and asp apps. However, when it comes to ASP.Net web app,...
1
by: Brian Simmons | last post by:
Hi All, I know that if you modify the web.config file or any file in the App_Code subfolder, that ASP.net 2.0 will "restart" the application (i.e. clear out any sessions, etc...). Are there...
10
by: fadel daher | last post by:
i am building an application to monitor servers. i have written code that gets me all running processes on remote server, but i cant manage to get a code to kill a remote process . can any one...
5
by: IUnknown | last post by:
Ok, we are all aware of the situation where modifying the folder structure (adding files, folders, deleting files, etc) will result in ASP.NET triggering a recompilation/restart of the application....
0
by: mina | last post by:
My application which is written in vb.net 2005 uses sql server 2005 express as a database, this application is multi-user. So i am used 3 xp machine to install my application i can say...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.