简体   繁体   中英

Run orientdb server from c#

I try run OrientDB server from c# code. When I run via Powershell my database works, but when I try run from code I get error like don't have connect to db. I thought problem is how long process starts but I used Thread.Sleep(20000) after processOrient.Start and it didn't help too. Other servers starts very well from code (but .exe files) My code:

 ProcessStartInfo processInfoOrient = new ProcessStartInfo()
 {
       FileName = @"B:\db\orientdb-3.0.29\bin\server.bat",           
       RedirectStandardError = true,
       RedirectStandardOutput = true,
       UseShellExecute = false,
       CreateNoWindow = false,
       WorkingDirectory = @"B:\db\orientdb-3.0.29\bin"
 };

 Process processOrient = new Process();
 processOrient.StartInfo = processInfoOrient;
 processOrient.Start();

How Can I do that? Thanks.

为了运行 bat 文件,你需要有 UseShellExecute = true。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM