渲染期间的 Windows Server 2008 特殊字体
因此,我们在 Server 2008 上运行一个服务,它启动一个进程(C# 应用程序)来进行一些渲染。该过程运行成功,但它使用系统字体(我相信是 Arial)而不是应该加载的字体。如果我通过登录服务器手动运行此过程,则字体会成功加载并且该过程会正确呈现。
我尝试使用 CreateProcessWithLogonW 运行此进程,但仍然不起作用。我假设这与 Server 2008 中的非交互式会话有关,但我不知道如何解决它。
So we have a service running on Server 2008 which kicks off a process (C# app) which does some rendering. The process is running successfully but it is using the system fonts (Arial I believe) instead of fonts which are supposed to be loaded. If I run this process manually by logging into the server, the fonts load successfully and the process renders correctly.
I have tried running this process by using CreateProcessWithLogonW but that still doesn't work. I am assuming this has to do with the non-interactive sessions in Server 2008 but I can't figure out how to solve it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最终通过使用 -i 和 -h 选项 PSExec 解决了这个问题。据我了解,它在幕后运行 CreateProcessWithLogonW 或类似的东西。这正确地使用 session0 之外的用户帐户创建了一个新会话。我唯一要做的就是确保我尝试运行该进程的用户接受 PSExec 的 EULA。我还运行了“交互式服务检测”服务,以防 EULA 在 session0 中弹出。之后,我关闭了“交互式服务检测”,因为我不再需要它(不太确定我是否需要执行最后一步)。
I ended up solving this by using PSExec using the -i and -h options. From what I understand, it runs CreateProcessWithLogonW or something similar under the scenes. This correctly created a new session with a user account outside of session0. The only thing I had to do was make sure that the EULA for PSExec was accepted for the user I was attempting to run the process with. I also ran the "Interactive Services Detection" service just in case the EULA popped up in session0. After that I turned off "Interactive Services Detection" as I no longer needed it (not really sure that I needed to do this last step).
我知道您找到了解决方案,但我遇到了与您非常相似的问题(通过计划任务运行应用程序将使用默认字体,但在本地运行时它将找到我安装的自定义字体)并且我找到了不同的解决方案;在 Server 2008 上,存在一个问题,即为非交互式用户安装自定义字体后不会立即注册,而常规用户(即在实际登录到计算机的用户上运行时)确实会立即注册字体。
对我有用的解决方案是简单地重新启动安装了字体的计算机,并且字体开始在非交互式帐户下工作,因为当计算机打开时它会正确注册。字体安装似乎存在一个错误,在重新启动之前,它无法为非交互式用户正确注册字体。
I know you found a solution, but I had a very similar issue to yours (running an application through a scheduled task would use the default font but when running locally it would find the custom font I installed) and I found a different solution; On Server 2008, there is an issue where custom fonts are not registered immediately after installing for non-interactive users, whereas regular users (i.e. when running on a user actually logged in to the machine) do have the font registered immediately.
The solution that worked for me was to simply restart the machine the font was installed on and the font started working under the non-interactive accounts, as when the computer is turned on it registers correctly. It appears the font installation has a bug where it doesn't register the font correctly for non-interactive users until a reboot.