怎么使用wpf或者winform程序宿主 asp.net core web apiasp.net core web api 自帶有自宿主,但不想用控制臺程序,想怎么宿主到winform或者wpf。這樣在windows服務器直接開啟這個中間層程序就可以了,不需要安裝以及部署iis
1 回答

郎朗坤
TA貢獻1921條經驗 獲得超9個贊
最簡單的方法就是,用WinForm程序調用dotnet,并隱藏cmd窗口:
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.FileName = "dotnet"; startInfo.Arguments = "xxx.dll"; startInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory; startInfo.UseShellExecute = false; startInfo.RedirectStandardInput = true; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; startInfo.CreateNoWindow = true; System.Diagnostics.Process.Start(startInfo);
- 1 回答
- 0 關注
- 1381 瀏覽
添加回答
舉報
0/150
提交
取消