c# - 从后台代码启动 OpenOffice 作为服务不起作用

标签 c# asp.net asp.net-mvc openoffice.org

在我的开发机器上一切正常。但是当我在服务器上尝试并从代码启动它时,OpenOffice 无法连接到端口 2002。如果我使用完全相同的命令从 cmd 启动它,它的工作....

我做错了什么?

命令命令

c:/openoffice/program/soffice.exe -headless -nologo -nofirststartwizard -norestore -accept=socket,host=localhost,port=2002;urp;StarOffice.Service

来自代码

            var info = new ProcessStartInfo("c:/openoffice/program/soffice.exe")
                {
                    UseShellExecute = false,
                    RedirectStandardInput = true,
                    RedirectStandardOutput = true,
                    RedirectStandardError = true,
                    Arguments = "-headless -nologo -nofirststartwizard -norestore -accept=socket,host=localhost,port=2002;urp;StarOffice.Service" 
                };




            var result = Process.Start(info);

最佳答案

在 IIS 管理器(此处为 IIS 7.5)中,进入您的应用程序使用的应用程序池的高级设置。将“加载用户配置文件”设置为 True。

这似乎是必需的,您已经拥有的 -nofirststartwizard 也是如此。

这两件事结合起来对我有用。

关于c# - 从后台代码启动 OpenOffice 作为服务不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14971797/

相关文章:

c# - ASP.NET MVC 结合 Web API 路由

c# - 部分 View 未渲染且 Action 方法被调用两次

asp.net-mvc - 我可以避免这种永久重定向来修复或添加 slug 吗?

asp.net - 对所有 ASP.NET MVC 错误使用全局(哑)错误页面?

c# - 在 ASP.Net MVC3 中使用 HtmlHelper 和分页呈现 View

c# - 我如何在 C# 中将字符串列表作为 SQL 参数传递

javascript - 更改复选框选中和取消选中时的复选框背景颜色

c# - Telerik 模态窗口中可以有网格吗?

c# - 混淆硬编码的许可证 key

c# - System.InvalidCastException : 'The SqlParameterCollection only accepts non-null SqlParameter type objects, not SqlParameter objects.'