NVENC from service not working

Hi, I have a question about NVENC Encoding,

We are building a system with NVENC for a transcoding of a live source to the webcast platform. If we launch the code from visual studio everything works fine, but when we compile it and installing it as a service we getting a D3DDeviceBase error. I think it has something to do with the session 0 en 1 from windows.

This is what the log says:

                    2 N/A: D3DDeviceBase::Init() - m_cpD3DDevice.Release()
		2 N/A: D3DDeviceBase::Init() - m_cpD3D.Release()
		2 N/A: D3DDeviceBase::Init() - Direct3DCreate9() OK
		4 N/A: ###Err###
			e:\work\cvsroot\mplatform\trunk\include\video\nvencoder.h(826): ASSERT( "(SUCCEEDED( hr ) && "m_d3dDevice.Init") || _nDevice > 0" )
			GetLastError()=0x0000012B (299)
		
Only part of a ReadProcessMemory or WriteProcessMemory request was compl..

Here are my system specs

operating System: Windows 10 Pro 64-bit (10.0, Build 10240) (10240.th1_st1.151104-1714)
Language: Dutch (Regional Setting: Dutch)
System Manufacturer: DFI Inc.
System Model: HD310-Q87CRM
BIOS: BIOS Date: 07/16/14 20:15:38 Ver: 04.06.05
Processor: Intel® Core™ i7-4770S CPU @ 3.10GHz (8 CPUs), ~3.1GHz
Memory: 8192MB RAM
Available OS Memory: 8130MB RAM
Page File: 2052MB used, 14270MB available
Windows Dir: C:\WINDOWS
DirectX Version: 12

Card name: NVIDIA GeForce GT 730
Manufacturer: NVIDIA
Chip type: GeForce GT 730
DAC type: Integrated RAMDAC
Device Type: Full Device
Device Key: Enum\PCI\VEN_10DE&DEV_1287&SUBSYS_84F51043&REV_A1
Display Memory: 6060 MB
Dedicated Memory: 1994 MB
Shared Memory: 4065 MB

Can anyone give me some more information about this issue?

A Windows service is meant to run unattended thus it doesn’t have a sense of UI. I guess you need to change your application architecture, I’d suggest you to make the service start another application on your project that will be responsible for the encoding. You can keep the application hidden if needed.