我已经构建了一个打印文档的应用程序。
在使用Visual调试模式运行应用程序时,我可以使用以下方法接收可用打印机的列表:
PrinterSettings.InstalledPrinters然后,我选择其中之一使用以下方法打印文档:
PrintDocument printDocument = new PrintDocument();
printDocument.PrinterSettings.PrinterName = "Fax" ; //or any other listed printer that is returned from the method above
printDocument.PrintPage += printDocument_PrintPage;
printDocument.Print();
void printDocument_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawRectangle(new Pen(Color.Red,10),new Rectangle(0,0,100,100));
}这在Visual中有效,但是当我将它迁移到同一台计算机上的IIS7根文件夹时,会出现一个错误:“没有安装打印机”
注意:当我将应用程序部署到根文件夹时,我仍然可以获得相同的可用打印机列表,但是当调用Print()方法时,web应用程序会抛出错误。
我使用的是命名空间System.Drawing.Printing
更新:我确实检查了System.Printing名称空间参考页面,它还显示了一个框,上面写着:
“不支持在System.Printing服务或ASP.NET应用程序或服务中使用ASP.NET命名空间中的类。”
发布于 2015-11-25 21:39:40
我也有同样的问题,您可以在服务中看到RPC (在服务中)是如何运行的(网络服务\本地系统),并将其放在IIS adance设置标识的应用程序池中。
希望我能帮上忙!
https://stackoverflow.com/questions/29913297
复制相似问题