![](/img/trans.png)
[英]How to start and stop an ASP.NET Core 2.1 app programmatically with Windows Authentication enabled?
[英]Programmatically start a .NET Core web app for Selenium testing
我目前正在尝试在Core Web应用程序上设置一些UI测试,但是我无法启动Web应用程序。 从Web应用程序目录直接使用命令行“dotnet run”工作。 当我在执行测试之前尝试使用Process来运行它时,问题就出现了。
var process = new Process
{
StartInfo =
{
FileName = "dotnet",
Arguments = "run",
WorkingDirectory = applicationPath
}
};
process.Start();
有没有人在遇到类似的问题之前和/或设法解决它? 我可能会误用Process
。
UseShellExecute
将UseShellExecute添加到我的StartInfo并将其设置为false
使其工作:
var process = new Process
{
StartInfo =
{
FileName = "dotnet",
Arguments = "run",
UseShellExecute = false,
WorkingDirectory = applicationPath
}
};
process.Start();
UseShellExecute
的默认值为true,但它类似于运行cmd dotnet run
而不是dotnet run
,这是我需要的。
试试这个
ProcessStartInfo Startinfo = new ProcessStartInfo();
Startinfo.FileName = "D:\\TFS\\QA\\SH_LoadTest\\SH_LoadTest\\bin\\Debug\\SH_LoadTest.exe";
StartInfo.Arguments="Your Arguements";
Process pro = Process.Start(Startinfo);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.