XNA Creators Club Online
Page 1 of 1 (5 items)
Sort Posts: Previous Next

Failed to create Direct3D device when running application as windows service

Last post 10/13/2008 7:36 PM by mythosarah360. 4 replies.
  • 5/8/2007 4:01 AM

    Failed to create Direct3D device when running application as windows service

    Does anyone know of any issues of running Direct3D inside windows service application ?
    The video application I am working on currently cannot create Direct3D device when ran as windows service.
    When I ran it in debug mode (with its own console), the application could run and I could play video with
    Direct3D.

    Does anybody know possible reasons of this behavior ?

    Thanks,
    Celios27
  • 5/8/2007 5:07 AM In reply to

    Re: Failed to create Direct3D device when running application as windows service

    Why would you want to use DirectX in a Service? Service are not normal applications, e.g. they might run in their own session/desktop, which is not viewable by the user. It is way safer and recommaned to move the DX code into a user application and let the service communicate with this application about what it should display.

    We are boki. The rest is known.

    The not so known part of the rest: It is Björn or Bjoern, but never Bjorn.

    Twitter ~ Bnoerj ~ SharpSteer ~ SgtConker.com
  • 5/8/2007 5:08 AM In reply to

    Re: Failed to create Direct3D device when running application as windows service

    Answer
    Reply Quote

    With this question there are two main things to consider. The first is that a direct3d device needs to have a display or Visual component, and the second is that a windows service is designed to run in the background where there is no display availible to it.

    So the answer is not it can not run in a service. If you would like to a have a visual component that displays information that is collected from a service, these would be two different applications and have a communications layer between them. Have a look at socket communication, or remoting..

  • 5/8/2007 8:10 PM In reply to

    Re: Failed to create Direct3D device when running application as windows service

    Thanks for the replies. :D
  • 10/13/2008 7:36 PM In reply to

    Re: Failed to create Direct3D device when running application as windows service

    Somebody on Gamedev.net suggested changing the settings in the "Log on" tab of the service's properties, to use the Local System account, and check the "Allow service to interact with desktop" box. This seems to work for me, it's not an XNA application but my CruiseControl.NET service is launching a commandlet that generates thumbnails using D3D9, and I had the same problem as you initially.

    @Bjoern: I guess you would want to use DirectX in a service for the same exact reasons you would want to run any other app :)  In the company I work for, we currently have 12 build servers performing various tasks for our game, and mostly I want everything to restart automatically when they reboot (for example, after some Windows update was pushed), without any user having to log in.

    Frederic

Page 1 of 1 (5 items) Previous Next