首页 > 解决方案 > [C#]:等待任务完成时达到 600 秒的最大超时

问题描述

在我的测试中,我有一个for循环,它运行一个 powershell 脚本,有时需要更长的时间来执行。我遇到了这样的错误:在等待任务完成时达到了 600 秒的最大超时。我想问一下,这个错误是否发生在整个测试需要超过 600 秒才能完成或一个脚本运行时间超过 600 秒?

PS我从命令行运行该测试

这会对我有帮助吗?如果不是,我应该改变什么?

process.WaitForExit(1000 * 60 * 60); //Wait up to one hour

编辑(整个例外):

等待任务完成时达到最大超时 600 秒:C:\Program Files (x86)\NUnit 2.6.4\bin\nunit-console.exe "C:\Tests\resources\test_scripts\api-tests-hd \Installers\Test1\bin\Release\Test1.dll" /xml:"C:\Tests\Results\Test1\39.xml"。2018-05-17 06:49:01,933 错误 StarterConsole.HttpPost - FileNotFoundException 在 HttpUploadFile 中写入 fileStream 到 dataStream!System.IO.FileNotFoundException:找不到文件“C:\Tests\Results\Test1\39.xml”。文件名:System.IO.__Error.WinIOError 处的“C:\Tests\Results\Test1\39.xml”(Int32 errorCode,String maybeFullPath)
在 System.IO.FileStream.Init(字符串路径、FileMode 模式、FileAccess 访问、Int32 权限、Boolean useRights、FileShare 共享、Int32 bufferSize、FileOptions 选项、SECURITY_ATTRIBUTES secAttrs、String msgPath、Boolean bFromProxy、Boolean useLongPath、Boolean checkHost)
在 System C 中 StarterConsole.HttpPost.HttpUploadFile(Uri postLocation, String file, String paramName, String contentType, Dictionary`2 postItems, Int32 retries) 的 .IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share): \repos\starterconsole\StarterConsole\Http\HttpPost.cs:第 293 行

标签: c#timeout

解决方案


推荐阅读