I have following C# console app (.NET Framework 4.7.2) on my server that is using 32 bit libraries for communicating with industrial PLC’s. The app is working quite normal when I run the exe directly. There is just few % additional CPU and memory consuption on the server.
But when I start the exe from my Blazor server side app that runs on the same server, the exe starts but I get immediatly lots of lines in the task manager called
“MS AFX Searches for standard libraries and sample projects (32 bit)”
that causes to %100 memory consumption just in few seconds. Also my exe is not executed. When I look to the eventviewer, strangly there are no Errors at the time where my exe was started for my Blazor server app.
What could be the reason?
Here my exe code:
using S7HCOM_XLib; //my 32 bit libraries
using SimaticLib; //my 32 bit libraries
namespace TestS7Command
{
internal class Program
{
static void Main(string[] args)
{
try
{
int retcode = 0;
ISimatic4 S = new Simatic();
IS7Project3 Pro;
S.UnattendedServerMode = true;
Pro = (IS7Project3) S.Projects.Add("Test8", "C:\temp", S7ProjectType.S7Project); // I open here an empty PLC project
Pro.UploadStationEx(0,2,"2","MPI",retcode); I download the project from the PLC to my empty project
}
catch (Exception ex)
{
using (StreamWriter sw = File.AppendText((@"C:templog.txt")))
{
sw.WriteLine("Error: " + ex + " " + Convert.ToString(DateTime.Now));
}
}
}
}
}
Here my razor.cs code where I start the exe
public void Start_Exe_Program()
{
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = path_of_exe,
CreateNoWindow = false, // Set to false to show the window
WindowStyle = ProcessWindowStyle.Hidden,// Set the window style to Normal
};
Process process = new Process
{
StartInfo = startInfo
};
process.Start();
}
7