“超时错误";使用IIS和网络打印机打印文档时抛出该错误 [英] "Timeout error" is thrown on printing the document using IIS and the network printer

查看:68
本文介绍了“超时错误";使用IIS和网络打印机打印文档时抛出该错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我的情况是在ASP.NET MVC平台中使用IIS和网络打印机打印文档.

对于下面的IIS Express代码段,打印"工作正常,但是当我们在IIS中托管示例(在生产环境中)时,打印时出现超时错误".

请找到代码段:

私有 无效 print_Click(对象发​​件人, EventArgs e)

       {

           PrintDocument printDocument = PrintDocument ();

           printDocument.PrintPage + = PrintPageEventHandler (正在打印);

           printDocument.Print();     

       }

       void 打印(对象 o, PrintPageEventArgs e)

       {

           字符串 path = Server.MapPath(〜/Data/image.bmp" );

           System.Drawing.图像 i = System.Drawing. Image .FromFile(path);

           p = (100,100);

           e.Graphics.DrawImage(i,p);

       }

请帮助我解决此问题.

预先感谢

Akshaya

解决方案

你好,Akshaya,

内部异常中是否还有其他详细信息?  登录到事件查看器中的任何内容都可能与之相关?

我的猜测是,这是IIS应用程序池标识的安全性.我的建议是将应用程序池设置为可以访问网络打印机的AD用户身份运行.

Hi Team,

My scenario is to print the document using IIS and the network printer in ASP.NET MVC platform.

The Printing is working fine for the below code snippet with IIS Express, but when we host the sample in IIS (in production environment) , we are getting "Timeout error" on printing.

Please find the code snippet:

private void print_Click(object sender, EventArgs e)

        {

            PrintDocument printDocument = new PrintDocument();

            printDocument.PrintPage += new PrintPageEventHandler(Printing);

            printDocument.Print();      

        }

        void Printing(object o, PrintPageEventArgs e)

        {

            string path=Server.MapPath("~/Data/image.bmp");

            System.Drawing.Image i = System.Drawing.Image.FromFile(path);

            Point p = new Point(100, 100);

            e.Graphics.DrawImage(i, p);

        }

Please help me to resolve this issue.

Thanks in Advance,

Akshaya

解决方案

Hello Akshaya,

Is  there additional detail in an inner exception?  Anything logged in eventviewer that might relate?

My guess is this is security with the IIS application pool identity.  My suggestion is to set the app pool to have run as a AD user that has access to the network printer. 


这篇关于“超时错误";使用IIS和网络打印机打印文档时抛出该错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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