Rawprinterhelper网络打印机ASP.NET MVC [英] Rawprinterhelper network printer ASP.NET MVC

查看:75
本文介绍了Rawprinterhelper网络打印机ASP.NET MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试使用RawPrinterHelper(由Microsoft开发的打印机支持类)从ASP.NET MVC3应用程序打印文档时遇到麻烦.我需要将RAW数据发送到本地连接到网络中计算机的打印机.

I'm having trouble trying to print a document from a ASP.NET MVC3 application using RawPrinterHelper (the printer support class developed by Microsoft). I need to send RAW data to a printer which is locally connected to a computer in the network.

在我的开发环境(MS Visual Studio 2010)中,一切正常.我将打印机作为网络打印机安装在操作系统中,并将该打印机的名称传递给RawPrinterHelper.在真正的测试服务器上,一切根本不起作用.操作系统是带有IIS7的Windows 7.确实,我需要使用在IIS上运行的应用程序中安装在本地Windows7客户端上的网络打印机.应用程序池标识设置为网络服务".使用Visual Studio 2010的内置Web服务器,一切正常.所有打印机都经过测试,可以正常工作.谢谢.

In my development environment (MS Visual Studio 2010) everything works well. I installed the printer in my OS as a network printer and I pass the name of that printer to RawPrinterHelper. On the real test server things don't work at all. The OS is Windows 7 with IIS7. Indeed I need to use a network printer installed on the local Windows7 client from my application running on IIS. The applicationpooling identity is set as "Network Service". Everything works using the built-in web server for Visual Studio 2010. All the printers are tested and work. Thanks.

推荐答案

我解决了这个问题.问题是ASP.NET应用程序正在IIS服务器上运行,并且不能访问网络打印机,而只能访问本地打印机.然后,Windows操作系统中的每个用户都只能访问自己的网络打印机.该问题可以通过以下方式解决:

I solved the problem. The issue is that the ASP.NET application is running on the IIS server and does not have access to network printers, but only to local printers. Then, every user in Windows OS has access only to his own network printers. The problem can be solved in this way:

1)使用操作系统的用户模拟ASP.NET应用程序2)授予用户使用数据库等的权限3)使用特定的用户配置文件登录并创建网络打印机4)准备好了

1) Impersonate the ASP.NET application with a user of the OS 2) Grant the user privileges to use databases, etc 3) Create, logged in with THAT specific user profile, your network printers 4) Ready

为RawPrinterHelper提供正确的字符串格式名称非常重要.为此,请检查System.Drawing.Printing.PrinterSettings并获取已安装打印机的列表.

It is very important to provide RawPrinterHelper with the right name in string format. To do so check System.Drawing.Printing.PrinterSettings and get the list of installed printers.

这篇关于Rawprinterhelper网络打印机ASP.NET MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆