无法加载文件或程序集“python.runtime”或其依赖项之一,尝试加载格式正确的程序我面临同样的问题,我的错误没有使用 phyton 3.5 解决,调用 phyton.exe 路径在 .net c# 控制器中执行 phyton 文件,只有在发布到服务器后才会遇到错误,它在我的系统中工作正常下面是我的代码if (Result.Success){ System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.FileName = "C:/Program Files/Python 3.5/python.exe"; startInfo.Arguments = "C:/PythonScripts/Test.py"; // startInfo.Arguments = HttpContext.Server.MapPath("~/PythonScripts/Test.py").ToString(); startInfo.Verb = "runas"; startInfo.UseShellExecute = false; startInfo.RedirectStandardError = true; startInfo.RedirectStandardOutput = true; process.StartInfo = startInfo; bool t = process.Start(); StreamReader myStreamReader = process.StandardError; string error = myStreamReader.ReadToEnd(); StreamReader reader = process.StandardOutput; string output = reader.ReadToEnd(); process.WaitForExit(); process.Close(); if (!error.Equals("")) { Result.Success = false; Result.Exception = true; }}
1 回答
吃鸡游戏
TA贡献1829条经验 获得超7个赞
没有太多关于您正在使用的信息,但有时,这badformatexception是因为您的项目配置与它抱怨的 dll 不兼容,请将其更改为 x86 或 x64。
- 1 回答
- 0 关注
- 221 浏览
添加回答
举报
0/150
提交
取消
