Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9255149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:38:57+00:00 2026-06-18T11:38:57+00:00

I am trying to run 2 exe in Parallel using Parallel.Invoke() Both the exe

  • 0

I am trying to run 2 exe in Parallel using Parallel.Invoke()
Both the exe is trying to access the same Database (but different tables). Also, the exe’s will run in two different servers.
I am using WMI with C# to start the batch file (which will invoke the other exe file) in the remote server.

Parallel.Invoke(() =>
            {
                RunInParallel();
            },
            () =>
            {
                InvokeModule("EmiCalculator.exe");
            } 
            );

void RunInParallel()
{
                var connoptions = new ConnectionOptions();
                var managementScope = new ManagementScope
                    (String.Format(@"\\{0}\ROOT\CIMV2", REMOTE_COMPUTER), connoptions);
                var wmiProc = new ManagementClass(managementScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());
                string commandLineInput = @"\\win-server1\D$\Data\Run.bat";
                var processToRun = new[] { commandLineInput };
                wmiProc.InvokeMethod("Create", processToRun);
}

Run.bat is calling SalaryCalculator.exe

Both the exe are having a configuration file with ConnectionString as below.

<add name="CONN" connectionString="Data Source=SERVER1-LAB1;Initial Catalog=Loan;Integrated Security=True"/>

When running, the exe in remote machine is getting crashed and throwing below exception :

Application: SalaryCalculator.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AggregateException
Stack:
   at System.Threading.Tasks.Task.WaitAll(System.Threading.Tasks.Task[], Int32, System.Threading.CancellationToken)
   at System.Threading.Tasks.Task.WaitAll(System.Threading.Tasks.Task[], Int32)
   at System.Threading.Tasks.Task.WaitAll(System.Threading.Tasks.Task[])

NOTE: If I run the batch file after connecting to remote machine, it is working perfectly. It is only throwing error when using with Parallel.Invoke()

How can I proceed here ? Any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:38:58+00:00Added an answer on June 18, 2026 at 11:38 am

    I was able to make this work. The issue was connection string as Integrated Secuity was mentioned.
    I just changed the connectionstring to use SQL server authentication instead of Windows authentication. And it worked fine.

    < add name="CONN" connectionString="Data Source=SERVER1-LAB1;Initial Catalog=Loan;User Id=sa;Password=xxxx12345678" /> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to run sdelete.exe ( http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx ) using cfexecute, but I think
I'm trying to run a .exe that requires some parameters by using system(). If
I'm trying to run various commands using psexec.exe from Windows Sysinternals . What I
I am trying to run a .exe from the server side on GWT but
I'm currently trying to run MSTest.exe from NCover, but I believe the question could
I'm trying to run genhtml using perl.exe from Cygwin in Windows. I have installed
Im trying to create a windows service with vb.net but when I run: InstallUtil.exe
I trying to run my jamsine specs from command line using PhantomJs.exe. Here is
I am trying to run xxx.exe file using command prompt with silent mode. i
I am trying run a curl command using powershell as follows: $command=.\curl.exe -k -X

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.