CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2008
    Posts
    1

    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 ...

  2. #2
    Join Date
    Nov 2007
    Location
    .NET 3.5 / VS2008 Developer
    Posts
    624

    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.

  3. #3

    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.

  4. #4
    Join Date
    Jul 2008
    Posts
    21

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured