【问题标题】:C# Send a toast notification from a Windows Service : UnauthorizedAccessExceptionC# 从 Windows 服务发送 toast 通知:UnauthorizedAccessException
【发布时间】:2022-06-16 00:35:02
【问题描述】:

我尝试在 Windows 服务中发送 Toast 通知,但我有这个例外:

System.UnauthorizedAccessException: Accès refusé。 (HRESULT 异常:0x80070005 (E_ACCESSDENIED)) à Windows.UI.Notifications.ToastNotifier.Show(ToastNotification 通知)

我的服务使用本地系统帐户运行。我尝试使用我的个人帐户,但还是一样。

using Microsoft.Toolkit.Uwp.Notifications;
...
ToastContentBuilder toast = new ToastContentBuilder()
                    .AddText("My title", hintMaxLines: 1)
                    .AddText("My text");
toast.Show();

Windows 10、.Net 4.8、C#

感谢您的帮助!

【问题讨论】:

    标签: c# notifications toast


    【解决方案1】:

    当我执行 gulp build [13:30:41] gulp-notify:[JHipster Gulp Build] 错误:El sistema no puede encontrar la ruta especificada。 [13:03:52] gulp-notify:[错误运行通知程序]无法发送消息:命令失败:C:\Users\BL5973\source\repos\SAM-WEB\node_modules\node-notifier\vendor\toaster\toast .exe - 字幕失败! -open -p C:\Users\BL5973\source\repos\SAM-WEB\node_modules\gulp-notify\assets\gulp-error.png -m 错误:El sistema no puede encontrar la ruta especificada。\n -t JHipster Gulp 构建

    除了无控制:System.UnauthorizedAccessException:Acceso denegado。 (HRESULT 例外:0x80070005 (E_ACCESSDENIED)) zh Windows.UI.Notifications.ToastNotifier.Show(ToastNotification 通知) en toast.Program.ShowToast(String title, String message, String imageURI, Boolean sound) en toast.Program.Main(String[] args)

    【讨论】:

      猜你喜欢
      • 2023-03-25
      • 2021-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-27
      • 1970-01-01
      • 2013-01-08
      • 2017-09-07
      相关资源
      最近更新 更多