.net core中引入fastreport.open在linux上发布

在linux端添加xServer应用;
然后,在web下面添加依赖项:runtime.linux-x64.CoreCompat.System.Drawing
在startup.cs中,添加如下命令:

       static Process xvfb;
        const string xvfb_pid = "pid.xvfb.fr";
        public Startup(IConfiguration configuration)
        {
            LinuxStart();
       
        }
       public static void LinuxStart()
        {
            if (File.Exists(xvfb_pid))
            {
                string pid = File.ReadAllText(xvfb_pid);
                try
                {
                    xvfb = Process.GetProcessById(int.Parse(pid));
                    xvfb.Kill();
                    xvfb = null;
                }
                catch { }
                File.Delete(xvfb_pid);
            }
            //string display = Environment.GetEnvironmentVariable("DISPLAY");
            //if (String.IsNullOrEmpty(display))
            //{
            //    Environment.SetEnvironmentVariable("DISPLAY", ":99");
            //    display = ":99";
            //}
            ProcessStartInfo info = new ProcessStartInfo();
            info.FileName = "/usr/bin/Xvfb";
            info.Arguments = ":99 -ac -screen 0 1024x768x32 +extension RANDR -dpi 96";
            info.CreateNoWindow = true;
            xvfb = new Process();
            xvfb.StartInfo = info;
            xvfb.Start();
            // File.WriteAllText(xvfb_pid, xvfb.Id.ToString());
        }

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容