微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用用户mssqlserver在C#中启动过程返回NULL

如何解决使用用户mssqlserver在C#中启动过程返回NULL

我有一个sqlserver 2016数据库。我正在运行一个存储过程,在这里我将其称为DLL程序集。在此程序集中,我正在执行System.Diagnostics.Process.Start来打印PDF。我在本地计算机上拥有了所有东西(SAP B1,sqlServer 2016和Adobe Reader)。一切都很好。但是在我的Windows Server 2016中,System.Diagnostics.Process.Start返回NULL。

当我从SAP B1添加数据时,sqlserver 2016执行我的存储过程并启动打印过程。

数据库启动此操作时,它使用的是NT SERVICE / MSsqlSERVER的用户。我认为该用户无法执行此操作。我检查了pdf文件和打印机的权限。

我认为缺少一些代码。我检查了这个社区,寻找解决方案,但是...

System.Diagnostics.Process printer = new System.Diagnostics.Process();

printer.StartInfo.Arguments = "\"" + impresora + "\""; //impresora seleccionada
printer.StartInfo.FileName = ruta + albaran + ".PDF";
printer.StartInfo.UseShellExecute = true;
printer.StartInfo.Verb = "PrintTo";
printer.StartInfo.CreateNowindow = false;
printer.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

if (System.Diagnostics.Process.Start(printer.StartInfo) == null)
    sqlContext.Pipe.Send("Process is not launched");

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。