【发布时间】:2019-05-13 23:58:26
【问题描述】:
有没有办法在 .NET Core WebAPI 中运行/使用 .NET Framework app/dll?我知道 .NET Core 不适用于 .NET Framework,所以我在询问某种解决方法。
我尝试过从 WebAPI 打开的 .NET Framework Console 应用程序,但我不确定这是否是个好主意。它在任何时候都不起作用,特别是当两个用户尝试同时运行它时。
string path = hostingEnvironment.ContentRootPath + exePath;
string json = ConvertToBase64(object);
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = path;
p.StartInfo.Arguments = json;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
return output;
我不想为我的 API 使用 .NET Framework。我不想使用 RabbitMQ 和类似的,因为它需要安装几个组件。 我需要在 .NET Core WebAPI 中使用 .NET Framework dll 中的一些方法。我无权访问 .NET Framework dll 代码。
【问题讨论】:
标签: asp.net-core asp.net-core-webapi