为了账号安全,请及时绑定邮箱和手机立即绑定

在 .net c# 控制器中使用 phyton.exe:

在 .net c# 控制器中使用 phyton.exe:

C#
拉丁的传说 2022-06-12 15:16:37
无法加载文件或程序集“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。



查看完整回答
反对 回复 2022-06-12
  • 1 回答
  • 0 关注
  • 221 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号