Help with ASP.net (c#) Web service
Hi ....
I have written this web service that starts a process, here is the code
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Threading;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Diagnostics;
using System.Data.SqlClient;
[WebService(Name="sys_info", Namespace = "system_info_service")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class system_information : System.Web.Services.WebService
{
public system_information () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public void control_process(string process_name)
{
Process p = new Process();
p.StartInfo.FileName = process_name;
p.Start();
}
}
when i run the webservice in visual studio ...it runs fine ...lets say if i pass the
argument C:\Windows\Notepad.exe to the control_process web method, it opens notepad...
But when i publish the web application to the local IIS folder and then run it from a browser ..it does not work ....i am able to access the web service ...and invoke the method ..but once invoked, nothing happens ....
does anyone have an idea as to what might be wrong ? its definitely something to do with the IIS settings ...but I don't know what ...
Re: Help with ASP.net (c#) Web service
by default, the ASPNET user account(the account that the webservice uses) does not have read/write access to hard drives. you will need to set the permissions of the folder to give the account read access.
Re: Help with ASP.net (c#) Web service
Also, depending on what you're trying to run it's not going to just show up directly. Any sort of windowed app will not appear on your desktop but should show up in the process list (assuming you've configured permissions correctly as eclipsed4utoo outlined.) Beyond that, you'll need to properly handle stdout and stderr to get the output.
Re: Help with ASP.net (c#) Web service
Please add the following line:
[System.Web.Script.Services.ScriptService]
just before the declaration of the webservice class
public class system_information : System.Web.Services.WebService
{
}
and check out if its working or not.