![](/img/trans.png)
[英]PrintTicket provider failed to bind to printer. Win32 error: The printer name is invalid
[英]System.Printing.PrintQueueException: PrintTicket provider failed to bind to printer. Win32 error: Access is denied
我有一个要在其中打印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.
我该如何解决?
看起来可能是此问题Microsoft bk2872151
它们为用户提供了一个修复程序,为开发人员建议的解决方案是确保您未在64位服务器上以32位模式运行(即切换到AnyCPU)。
请注意,在VS2013中,即使您选择AnyCPU,也存在一个额外的复选框,用于首选32Bit
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.