I´m new to c#, .net core world and figuring out a POC for our needs.

Basically its a Windows Service created with .net core (like here explained: Create a Windows Service using BackgroundService). Our goal is to send push notification (raw push notification, trigger some tasks in behind) to our Windows Service and as i understood it there is no way to do it for a non-packaged application (without package identity) like our Windows Service project. Since this is a simple console application.

So i found that we can grant package identity which is precondtion for creating push notification channel, by this Doc: Grant identity to non-packaged desktop apps

But here is the problem, when i add package identity to our project/.exe, more precisely adding the application.manifest with the msix node to the Windows Service it is not more possible to start the Windows Service. Everything is fine, i can execute the .exe and it also return me the Channel URI, but if i create a Windows Service of it and try to start it, i get the following error: "5: Access denied". Removing the msix node from the application.manifest from the project, building it new, it is possible to create and start the Windows Service. But without package identity i cant get the channel Uri.

Yes, we do need a Windows Service because this fits our other ideas.

It is even possible the send push notifications over WNS to a Windows Service? If so, did i went the right way and missed something or is there another way to do it?

1

There are 1 answers

1
Wilfried Zebardi On

In you grant package process, did you use some relative path? Because it's possible that if you are using some relative path, trying to run the exe file from outside of the directory where it's located won't work as the files needed won't exit.

For test purpose, if you open command line in a another directory that the one containing you exe file and try to run it, does it run or fail? For example if your file is C:\Program Files\Test\test.exe. If you open command line at C:\Program Files and do .\Test\test.exe do you get the same error.