DubyaDude / WindowsMediaController

Allows developers to more easily get information from and interact with the Windows 10/11 OS media interface. (Also referred to Windows System Media Transport Controls (SMTC))
https://nuget.org/packages/Dubya.WindowsMediaController
MIT License
129 stars 9 forks source link

Help: System.Exception: The specified service does not exist as an installed service. #3

Closed jean3x7 closed 2 years ago

jean3x7 commented 2 years ago

How to run this lib through Task Scheduler?

It works perfectly if starting manually via compiled exe or calling the exe via cmd/powershell.

But in Task Scheduler Returns below error: "mediaManager.Start()"

System.Exception: The specified service does not exist as an installed service.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at SystemWebMonitorInterface.MediaManager.Start() in C:\Projects\SystemMonitorWebInterface\bin\SystemWebMonitorInterface\SystemWebMonitorInterface\MediaManager.cs:line 63 at SystemWebMonitorInterface.Program.<>c.<

b__12_2>d.MoveNext() in C:\Projects\SystemMonitorWebInterface\bin\SystemWebMonitorInterface\SystemWebMonitorInterface\Program.cs:line 213 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() at System.Threading.ThreadPoolWorkQueue.Dispatch()

jean3x7 commented 2 years ago

I found a solution.

If the app started hidden, the above message happens, the workaround is to start the app and then hide (eg running on the web server).

DubyaDude commented 2 years ago

I know exactly what you ran into. And yes, the only solution I know so far is to run it starting out in an 'interactive' mode (aka having a window). I don't believe there's any other workaround for it, if you do figure out something else let me know.

I'll look into specifying that into the requirements section. Thanks~

jean3x7 commented 2 years ago

Thanks for your reply, the 'interactive' mode is a solution!

Now i can forward the info to my web socket

image