I now have something like this:
public class Service1 : System.Web.Services.WebService { [WebMethod] public string Method1() { SomeObj so = SomeClass.GetSomeObj();
Is it possible to make a statefull web service so that I can reuse SomeObj so and just call methods on the same object?
Thus, the client who will use this service will first call the web method, which will create the so object and return some identifier. And then in subsequent calls, the web service will use the same so object based on the identifier.
EDIT
Here is my actual code:
[WebMethod] public List<ProcInfo> GetProcessList(string domain, string machineName) { string userName = "..."; string password = "..."; TaskManager tm = new TaskManager(userName, password, domain, machineName); return tm.GetRunningProcesses(); } [WebMethod] public bool KillProcess(string domain, string machineName, string processName) { string userName = "..."; string password = "..."; (new TaskManager(userName, password, domain, machineName);).KillProcess(processName); }
c # web-services persistence stateful
Primoz
source share