Index: /branches/MPI/HeuristicLab.ExtLibs/HeuristicLab.MPInet/1.0.0/HeuristicLab.MPInet-1.0.0.csproj
===================================================================
--- /branches/MPI/HeuristicLab.ExtLibs/HeuristicLab.MPInet/1.0.0/HeuristicLab.MPInet-1.0.0.csproj	(revision 6393)
+++ /branches/MPI/HeuristicLab.ExtLibs/HeuristicLab.MPInet/1.0.0/HeuristicLab.MPInet-1.0.0.csproj	(revision 6394)
@@ -168,6 +168,11 @@
   </PropertyGroup>
   <PropertyGroup>
-    <PostBuildEvent>
-    </PostBuildEvent>
+    <PostBuildEvent>set ProjectName=$(ProjectName)
+set Source=$(TargetPath)
+set Configuration=$(ConfigurationName)
+set Platform=$(PlatformName)
+set SolutionDir=$(SolutionDir)
+
+if exist "$(SolutionDir)CustomPostBuild.cmd" call "$(SolutionDir)CustomPostBuild.cmd"</PostBuildEvent>
   </PropertyGroup>
 </Project>
Index: /branches/MPI/HeuristicLab.MPIAlgorithmRunner/3.3/AlgorithmBroker.cs
===================================================================
--- /branches/MPI/HeuristicLab.MPIAlgorithmRunner/3.3/AlgorithmBroker.cs	(revision 6393)
+++ /branches/MPI/HeuristicLab.MPIAlgorithmRunner/3.3/AlgorithmBroker.cs	(revision 6394)
@@ -32,4 +32,5 @@
 using HeuristicLab.Core;
 using System.Threading;
+using System.Xml;
                      
 namespace HeuristicLab.MPIAlgorithmRunner {
@@ -53,8 +54,14 @@
       endpoint.Name = "AlgorithmBrokerEndpoint";
       NetTcpBinding netTCPBinding = new NetTcpBinding(SecurityMode.None);
+      netTCPBinding.MaxReceivedMessageSize = int.MaxValue;
+      XmlDictionaryReaderQuotas quotas = new XmlDictionaryReaderQuotas();
+      quotas.MaxArrayLength = int.MaxValue;
+      netTCPBinding.ReaderQuotas = quotas;
       endpoint.Binding = netTCPBinding;
       int port = FindFreeTcpPort();
       endpoint.Address = new EndpointAddress("net.tcp://localhost:" + port + "/AlgorithmBroker");
       service.AddServiceEndpoint(endpoint);
+      ServiceDebugBehavior debug = service.Description.Behaviors.Find<ServiceDebugBehavior>();
+      debug.IncludeExceptionDetailInFaults = true;
 
       return service;
@@ -85,5 +92,5 @@
     public void TransmitAlgorithm(MPITransportWrapper<IAlgorithm> algorithm) {
       Console.WriteLine("Transmitting Algorithm...");
-      int clients = MPI.Communicator.world.Group.Size;
+      int clients = MPI.Communicator.world.Group.Size - 1;
 
       for(int i = 0; i < clients; i++) {
Index: /branches/MPI/HeuristicLab.MPIAlgorithmRunner/3.3/HeuristicLab.MPIAlgorithmRunner-3.3.csproj
===================================================================
--- /branches/MPI/HeuristicLab.MPIAlgorithmRunner/3.3/HeuristicLab.MPIAlgorithmRunner-3.3.csproj	(revision 6393)
+++ /branches/MPI/HeuristicLab.MPIAlgorithmRunner/3.3/HeuristicLab.MPIAlgorithmRunner-3.3.csproj	(revision 6394)
@@ -129,4 +129,5 @@
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.ServiceModel" />
     <Reference Include="System.Xml.Linq" />
@@ -168,4 +169,13 @@
 SubWCRev "%25ProjectDir%25\" "%25ProjectDir%25\HeuristicLabMPIAlgorithmRunnerPlugin.cs.frame" "%25ProjectDir%25\HeuristicLabMPIAlgorithmRunnerPlugin.cs"</PreBuildEvent>
   </PropertyGroup>
+  <PropertyGroup>
+    <PostBuildEvent>set ProjectName=$(ProjectName)
+set Source=$(TargetPath)
+set Configuration=$(ConfigurationName)
+set Platform=$(PlatformName)
+set SolutionDir=$(SolutionDir)
+
+if exist "$(SolutionDir)CustomPostBuild.cmd" call "$(SolutionDir)CustomPostBuild.cmd"</PostBuildEvent>
+  </PropertyGroup>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
Index: /branches/MPI/HeuristicLab.MPIAlgorithmRunner/3.3/Program.cs
===================================================================
--- /branches/MPI/HeuristicLab.MPIAlgorithmRunner/3.3/Program.cs	(revision 6393)
+++ /branches/MPI/HeuristicLab.MPIAlgorithmRunner/3.3/Program.cs	(revision 6394)
@@ -41,6 +41,8 @@
 
       // Discover the job's context from the environment
-      String headNodeName = System.Environment.GetEnvironmentVariable("CCP_CLUSTER_NAME");
+      String headNodeName = System.Environment.GetEnvironmentVariable("CCP_SCHEDULER");
       int jobId = System.Convert.ToInt32(System.Environment.GetEnvironmentVariable("CCP_JOBID"));
+
+      Console.WriteLine(jobId + "@" + headNodeName); 
 
       // Connect to the head node and get the job
@@ -63,5 +65,7 @@
     static void Main(string[] args) {
       using (new MPI.Environment(ref args)) {
-        int clients = MPI.Communicator.world.Group.Size;
+        int clients = MPI.Communicator.world.Group.Size - 1;
+        Console.WriteLine("Clients: " + clients);
+
         int updateInterval = 5000;
 
Index: /branches/MPI/HeuristicLab.MPIEngine/3.3/HeuristicLab.MPIEngine-3.3.csproj
===================================================================
--- /branches/MPI/HeuristicLab.MPIEngine/3.3/HeuristicLab.MPIEngine-3.3.csproj	(revision 6393)
+++ /branches/MPI/HeuristicLab.MPIEngine/3.3/HeuristicLab.MPIEngine-3.3.csproj	(revision 6394)
@@ -128,6 +128,10 @@
       <HintPath>..\..\HeuristicLab.ExtLibs\HeuristicLab.MPInet\MPIAlgorithmRunner\3.3\Microsoft.Hpc.Scheduler.dll</HintPath>
     </Reference>
+    <Reference Include="Microsoft.Hpc.Scheduler.Properties, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\Microsoft.Hpc.Scheduler.Properties.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.ServiceModel" />
     <Reference Include="System.Xml.Linq" />
Index: /branches/MPI/HeuristicLab.MPIEngine/3.3/MPIEngine.cs
===================================================================
--- /branches/MPI/HeuristicLab.MPIEngine/3.3/MPIEngine.cs	(revision 6393)
+++ /branches/MPI/HeuristicLab.MPIEngine/3.3/MPIEngine.cs	(revision 6394)
@@ -35,4 +35,6 @@
 using HeuristicLab.MPIAlgorithmRunner;
 using HeuristicLab.Operators.MPISupport;
+using Microsoft.Hpc.Scheduler.Properties;
+using System.Xml;
 
 namespace HeuristicLab.MPIEngine {
@@ -74,5 +76,19 @@
     }
 
+    protected override void OnPaused() {
+      base.OnPaused();
+
+      Stop();
+    }
+
     protected override void Run(System.Threading.CancellationToken cancellationToken) {
+      string username = @"user";
+      string password = @"password";
+      string headNode = "blade00.hpc.fh-hagenberg.at";
+      List<string> requestedNodes = new List<string>();
+      requestedNodes.Add("BLADE00");
+      string path = @"C:\public\MPISupport";
+      int cpuPerNode = 8;
+
       if (ExecutionStack.Count == 1) {
         ExecutionContext context = ExecutionStack.Pop() as ExecutionContext;
@@ -81,12 +97,13 @@
 
         string exec = @"mpiexec";
-        string args = @"-c 3 C:\public\MPISupport\HeuristicLab.MPIAlgorithmRunner-3.3.exe ";
+        string args = @"-c " + cpuPerNode + " /genvlist CCP_JOBID " + path + @"\HeuristicLab.MPIAlgorithmRunner-3.3.exe";
 
         IScheduler scheduler = new Scheduler();
-        scheduler.Connect("blade00.hpc.fh-hagenberg.at");
+        scheduler.Connect(headNode);
 
         ISchedulerJob job = scheduler.CreateJob();
         job.Name = "HeuristicLab.MPIEngine";
-        job.RequestedNodes.Add("BLADE03");
+        foreach (string requestedNode in requestedNodes)
+          job.RequestedNodes.Add(requestedNode);
         ISchedulerTask task = job.CreateTask();
         task.Name = "HeuristicLab.MPIAlgorithmRunner";
@@ -94,8 +111,9 @@
         task.StdOutFilePath = "stdout.txt";
         task.StdErrFilePath = "stderr.txt";
+        task.WorkDirectory = path; 
         task.MinimumNumberOfCores = task.MaximumNumberOfCores = 3;
         job.AddTask(task);
 
-        scheduler.SubmitJob(job, @"HPC\svonolfe", @"Vunkopf!3");
+        scheduler.SubmitJob(job, username, "");
 
         try {
@@ -104,15 +122,17 @@
 
           while (address == null && timeout > 0) {
+            cancellationToken.ThrowIfCancellationRequested();
+
             ISchedulerJob schedulerJob = scheduler.OpenJob(job.Id);
             if (schedulerJob != null) {
-              INameValueCollection properties = schedulerJob.GetCustomProperties();
-              NameValue item = properties.FirstOrDefault(i => i.Name == "address");
-              if (item != null) {
-                address = item.Value;
+              NameValue property = schedulerJob.GetCustomProperties().FirstOrDefault(p => p.Name == "address");
+
+              if (property != null) {
+                address = property.Value;
               } else {
                 System.Threading.Thread.Sleep(1000);
                 timeout--;
               }
-            }
+            }            
           }
 
@@ -122,4 +142,8 @@
 
           NetTcpBinding netTCPBinding = new NetTcpBinding(SecurityMode.None);
+          XmlDictionaryReaderQuotas quotas = new XmlDictionaryReaderQuotas();
+          quotas.MaxArrayLength = int.MaxValue;
+          netTCPBinding.ReaderQuotas = quotas;
+          netTCPBinding.MaxReceivedMessageSize = int.MaxValue;
           ChannelFactory<IAlgorithmBroker> factory = new ChannelFactory<IAlgorithmBroker>(netTCPBinding, address);
           IAlgorithmBroker proxy = factory.CreateChannel();
@@ -128,4 +152,6 @@
 
           while (!proxy.IsAlgorithmTerminated()) {
+            cancellationToken.ThrowIfCancellationRequested();
+
             ItemList<ResultCollection> results = proxy.GetResults().InnerItem;
 
@@ -143,6 +169,13 @@
         }
         catch (Exception e) {
-          scheduler.CancelJob(job.Id, "Exception: " + e.Message);
+          scheduler.CancelJob(job.Id, "Exception: " + e.GetType());
           throw e;
+        }
+        finally {
+           /*ISchedulerJob schedulerJob = scheduler.OpenJob(job.Id);
+           if (schedulerJob != null &&
+             (schedulerJob.State == JobState.Running || schedulerJob.State == JobState.Queued)) {
+               scheduler.CancelJob(job.Id, "Cancelled");            
+           } */
         }
       }
Index: /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/MPITransportWrapper.cs
===================================================================
--- /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/MPITransportWrapper.cs	(revision 6393)
+++ /branches/MPI/HeuristicLab.Operators.MPISupport/3.3/MPITransportWrapper.cs	(revision 6394)
@@ -49,7 +49,7 @@
 
     protected MPITransportWrapper(SerializationInfo info, StreamingContext context) {
-      MemoryStream stream = new MemoryStream(info.GetValue("Item", typeof(byte[])) as byte[]);
-      if (stream != null)
-        innerItem = XmlParser.Deserialize(stream) as T;
+      byte[] buffer = info.GetValue("Item", typeof(byte[])) as byte[];
+      if (buffer != null)
+        innerItem = XmlParser.Deserialize(new MemoryStream(buffer)) as T;
       else
         innerItem = null;
