c# - How to use IPC without being a local Admin? -


I currently The application uses IPC to maintain a running session at one time; If any other session is attempted to open (when someone clicks the icon again, some one opens the saved result file), the second session ends the communication and after that, the first session request Along with starting action.

I use the System.ServiceModel namespace at this time, such as:

namespace EventLogViewer.IPCServer {// common framework procedures provided to communicate oneanother

 <. Code> [ServiceContract (namespace = "http: //ELV.domain")] Interface IELVLauncher {[OperationContract] bool LaunchTabs (String [] filename); } Public Representative Zero Tab Laurent (string [] fileNames;); Class ELVLauncherServer: IDisposable {ServiceHost ipcService; Public ELVLauncherServer () {Uri Bjedder = New Uri ("http: // localhost: 45600 / alveolar / service"); String address = "netpipe: // localhost / avalanche / tabulator"; IpcService = New Service Host (Typef (ALV Launcher), BaseEdress); NetNamedPipeBinding Binding = New NetNamedPipeBinding (NetNamedPipeSecurityMode.None); IpcService.AddServiceEndpoint (typeof (IELVLauncher, binding, address); ServiceMetadataBehavior behavior = new service data usage (); Behavior HttpGetEnabled = True; Behavior.HttpGetUrl = new Uri ("http: // localhost: 45601 / avalanche"); IpcService.Description.Behaviors.Add (behavior); Utilities Wrightmomori debugastament (new debugattament (debugstattent.atit type.INO, "registering IPC service")); IpcService.Open (); } # Field IDisposable members dispose of public zeros () {ipcService.Close (); } #endregion} public class ELVLauncher: IELVLauncher {#region IELVLauncher member public bool LaunchTabs (string [] filename) {Utilities.WriteMemoryDebugStatement (New DebugStatement (DebugStatement.StatementType.INFO, String.Format ( "received IPC request files try {{0} ", Stringkjon (", ", filename))); ProgramkmainWindowkbackgroundListener_OnLaunchRequestReceived (filename);} catch (exception exception) {Upyogitaonkprkashmomori Dibgstatment (new Dibgstatment (exceptions));} Return (true);} #endregion}  

This code is basically under Windows XP Most corporations did not go to Vista, as we all run as local administrators, this code ran without a problem.

7 Win though, we Now, and because this Indian Penal Code can not be registered endpoint, this code creates an exception at startup. More information is given here:

Administrators need to be privatized given above. It does not work for two reasons:

  1. The application administrator privledges otherwise do not need
  2. We use ClickOnce to deploy our internal tools and ClickOnce And does not support anything compared to running as a process launcher.

At this time I need to find an IPC solution for which Administrator does not require privatization and lets me achieve the basic goal: Finding an example already running There is no suggestion on the code and what to do, otherwise what to do to launch itself (in the net framework, there is no third party solution) would be greatly appreciated.

This is an incredibly difficult to ensure a session of your app (and as you found it Is the problematic way)

edit

To get around the communication bit you have in your temporary folder provided by your own special prefix or OS An extension that voted in an app (filtering for its special prefix and / or extension) with a temporary Mr. file can cause see what to see were more request:

  System.IO.Path.GetTempFileName  

and

  System.IO.Path.GetTempPath  

Comments