Monday, 15 March 2010

c# - Executing msbuild process through code gets exit code -1073741502 -


using my application Process.Start () is executing MSBuild.exe, The appearance of another user is going on. The process is running as a service, fails immediately in executing the process and returns the error code -1073741502 .

  • I am performing my code as a service.
  • No matter what user, or permissions I allow it (as administrator too).
  • Service user has the local security policy as both run as a service and impersonate another user
  • any It does not matter which my logging methods have not been called. Does this mean that it is failing even before it starts?
  • There is no problem executing other executables in this manner.
  • When my code is not executed as a service, it is executed successfully.
  • WTF negative error code is 1073741502 ?? (!!) I've found that the closest thing

Example code:

  void main () {var startInfo = new ProcessStartInfo {fileName = path, logic = args, WorkingDirectory = workingPath, CreateNoWindow = true is, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, LoadUserProfile = true, domain = System.Environment.MachineName, UserName = creds.Username, password = generate Krensecr string (creds.Password)}; Var Process = Process Start (startInfo); Process.OutputDataReceived + = process_outputDataReceived; Process.ErrorDataReceived + = process_outputDataReceived; Process.exited + = process_Exited; Process.EnableRaisingEvents = True; Process.WaitForExit (); } Internal zero process_optput data (object sender, data rescue event Eg) {Console.WriteLine (E.Data); } Zero process_Exited (object sender, EventArgs e) {var process = (process) sender); Console.light line ("Process execution has expired, exit code '{0}'.", Process.ExitCode); } Personal SecureString generatesSecureString (string password) {var safe = new SecureString (); Forchach (password in password. Cochrane ()) {secure. AppendChar (c); } Return safe; }  

Any help would really be appreciated, seems to be a permission / issue of the local security policy, but without knowing more I think that the problem of my problem solving is "the definition of insanity" Has reached, where I am hoping for a different result.

Event log I check to see the following exception (vague as hell):

  application name Faulting: MSBuild.exe, Version: 12.0.31101.0 time Stamp: 0x545443d5 Faulting module name: KERNELBASE.dll, version: 6.3.9600.17668, time stamp: 0x54c846bb exception code: 0xc0000142 fault offset: 0x0009e052 Faulting process id: 0x3e8 Faulting application start time: 0x01d065cdac34cc77 Faulting application path: C: \ Program Files (x86) \ MSBuild \ 12.0 \ Bin \ Module Path Faulting MSBuild.exe: KERNELBASE.dll Iport number: ecce8b9d-d1c0-11e4-80d7-00155d611ee6 defective package Full name: Faulting package-oriented application ID:  

According to this thread, the result related to a proc start service can be in the native CreateProcessWithLogonW API call, which is not working from any service because I think I am facing the same problem, but the powerhell start process is running in a service (which may be of CreateProcessWithLogonW I just got this formula with internal commandlet to use.


No comments:

Post a Comment