473,326 Members | 2,076 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,326 software developers and data experts.

Problem with C# web service

Hi ....

I have written this web service that starts a process, here is the code

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Web;
  3. using System.Web.Services;
  4. using System.Web.Services.Protocols;
  5. using System.Threading;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using System.IO;
  12. using System.Diagnostics;
  13. using System.Data.SqlClient;
  14. [WebService(Name="sys_info", Namespace = "system_info_service")]
  15. [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  16. public class system_information : System.Web.Services.WebService 
  17. {
  18.  
  19.  
  20.    public system_information () {
  21.  
  22.         //Uncomment the following line if using designed components 
  23.         //InitializeComponent(); 
  24.  
  25.  
  26.     }
  27.  
  28.  
  29.  
  30.     [WebMethod]
  31.      public void control_process(string process_name)
  32.      {
  33.  
  34.          Process p = new Process();
  35.          p.StartInfo.FileName = process_name;
  36.          p.Start();
  37.  
  38.     }
  39.  
  40. }
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 ...
Sep 6 '08 #1
1 971
balabaster
797 Expert 512MB
I don't know for sure, but I'd hazard a guess that the issue is security. When you're running the web service in Visual Studio it has different permissions than when it's running in IIS. When you run the service as a web service in IIS, it is running in a partially trusted environment. I'm not sure exactly how to alleviate the issue because what you're doing is inherently dangerous... you'll have to allow the service carte-blanche access to shut processes down at the whim of whoever uses it. So you'll need to find a way to grant that security level system wide. Look up AllowPartiallyTrustedCallersAttribute if this is what's causing your issue, then this should point you in the right direction...
Sep 7 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: David Fraser | last post by:
Hi We are trying to debug a problem with services created using py2exe. It seems that these problems have arisen after services were installed and removed a few times. OK, first the actual...
0
by: David | last post by:
I've written a small windows service, and I'm having a problem that I'm spending a lot more time on than I'd like. If anyone has experienced this problem and has any hints or solutions; they would...
9
by: Sudesh Sawant | last post by:
Hello, We have an application which communicates using remoting. There is a server which is a Windows Service. The server exposes an object which is a singleton. The client is a Web Application...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: =?Utf-8?B?aGVsZmk=?= | last post by:
Hi all, I have replied with my own questions to an older post entry but after a while I thought it's better to start a new thread based on the previous one. Perhaps with the new thread I will...
4
by: Dave Burns | last post by:
I am self hosting a Web Service in a Windows service. I am trying to start the service using the NT AUTHORITY\NetworkService account. I get a NullReferenceException on ServiceHost.Open() in the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.