ASP.NET IIS服务器端打印失败 [英] ASP.NET IIS server side printing fails

查看:255
本文介绍了ASP.NET IIS服务器端打印失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个需要使用PrintDocument方法打印的ASP.NET应用程序:

I'm building an ASP.NET application that requires printing using PrintDocument method:

PrintDocument.Print()

打印在IIS Express的开发环境中正常运行。将其发布到Intranet IIS服务器时,打印失败,我认为这是由aspnet工作进程的权限问题引起的。

Printing works properly in development env with IIS express. when publishing it to an intranet IIS server, printing fails, which I think is caused by permission issue for aspnet working process.

我尝试执行以下操作但没有成功:

I tried to do the following with no success:


  • 我为管理本地用户创建了一个集成管道模式的应用程序池,其中加载用户配置文件选项设置为 true

  • 我将应用程序移动到新创建的应用程序池

  • 我添加了< identity impersonate =trueusername =usernamepassword =*****/> 在web.config文件中

  • 出现错误说明:检测到的ASP.NET设置不适用于集成管理管道模式所以我添加了< validation validateIntegratedModeConfiguration =false/> < system.webServer> 部分。

  • I created an application pool in integrated pipeline mode for an admin local user with load user profile option set to true
  • I moved the application to the new created application pool
  • I added <identity impersonate="true" username="username" password="*****"/> in web.config file
  • An error appeared stating that: An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode so I added <validation validateIntegratedModeConfiguration="false"/> to <system.webServer> section.

任何帮助拜托?

推荐答案

我想你可能会误解一些基金会这里的概念。当您使用 PrintDocument.Print()时,您正在服务器上打印。在IIS中部署应用程序时,此打印将在托管应用程序的服务器计算机上进行。您认为您的代码在IIS Express中正常工作的原因是因为您在与测试它的客户端浏览器相同的计算机上托管您的应用程序。此外,您在您的帐户下运行了已配置打印机的应用程序。

I think you might be misunderstanding some fundamental concepts here. When you use PrintDocument.Print() you are printing on the server. When you deploy your application in IIS this printing will happen on the server computer that is hosting your application. The reason why you thought your code was working in IIS Express is because you were hosting your application on the same computer as the client browser that was testing it. Also you were running your application under your account which had a printer configured.

您无法从Web应用程序直接打印到客户端计算机。这将是一个很大的安全问题。您可以做的最好的事情是使用打印 media CSS提供一些HTML文档输入 。然后,如果用户决定,他可以在他的浏览器中打印它。

You cannot print directly to the client computer from a web application. That would be a big security issue. The best you could do is provide some HTML document using a print media CSS type. Then if the user decides, he might print it in his browser.

如果另一方面你想在连接到你的网络服务器的某台打印机上打印,你将需要在IIS中配置应用程序池,以在其配置文件中配置了打印机的标识下运行。

If on the other hand you want to print on some printer that is attached to your web server, you will need to configure the Application Pool in IIS to run under an identity that has a printer configured in its profile.

这篇关于ASP.NET IIS服务器端打印失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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