【问题标题】:System.Printing.PrintQueueException: PrintTicket provider failed to bind to printer. Win32 error: Access is deniedSystem.Printing.PrintQueueException:PrintTicket 提供程序无法绑定到打印机。 Win32 错误:访问被拒绝
【发布时间】:2013-03-12 02:07:17
【问题描述】:

我有一个要打印 Word 文档的应用程序。 我正在使用第三方 GemBox 软件,并且在我的开发环境中此代码有效;

public void OutputLetter(string outputFile, string placeholder, string newText)
{
    using (var document = DocX.Load(this.InputFile))
    {
        document.ReplaceText(placeholder, newText);
        document.SaveAs(outputFile);
    }

    this.PrintDocument(outputFile);
}

private void PrintDocument(string outputFile)
{
    var document = DocumentModel.Load(outputFile, LoadOptions.DocxDefault);
    document.Print(AppSettings.PrinterName);
}

AppSettings.PrinterName 是存储在 web.config 中的打印机的名称。 一旦我部署它,我就会在线得到这个错误; “document.Print(AppSettings.PrinterName);”

System.Printing.PrintQueueException: PrintTicket provider failed to bind to printer. Win32 error: Access is denied. 

在我得到的事件查看器上;

The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID 
{BA7C0D29-81CA-4901-B450-634E20BB8C34}
 and APPID 
{AA0B85DA-FDDF-4272-8D1D-FF9B966D75B0}
 to the user IIS APPPOOL\Mulalley SID (S-1-5-82-1744840036-3971326342-2272496405-1389653927-2904033151) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool.

我该如何解决这个问题?

【问题讨论】:

    标签: c# gembox-document


    【解决方案1】:

    看起来可能是这个问题Microsoft bk2872151

    他们为用户提供了修复,建议开发人员的解决方案是确保您没有在 64 位服务器上以 32 位模式运行(即切换到 AnyCPU)。

    请注意,在 VS2013 中,即使您选择 AnyCPU,也会有一个额外的复选框来选择 32Bit

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-15
      • 1970-01-01
      • 2012-01-01
      • 1970-01-01
      • 2016-10-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多