本地打印方法有效,但配置iis无效 [英] Locally print method working but configure iis not working

查看:101
本文介绍了本地打印方法有效,但配置iis无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个在本地工作的打印方法,但是此Web服务(Web方法)在IIS6.0中托管.


Hi Everybody,

I have a print method it''s working locally but this web service(web method) host in IIS6.0.


//this is my code
const string acrobatPath = @"C:\Program Files (x86)\Adobe\Reader 9.0\Reader\AcroRd32.exe";

            string parameters = String.Format("/t /o {0} \"{1}\"", pdfFilepath, printerName);
            System.Diagnostics.ProcessStartInfo processStartInfo = new System.Diagnostics.ProcessStartInfo(acrobatPath, parameters);

            System.Diagnostics.Process process = System.Diagnostics.Process.Start(processStartInfo);
            System.Threading.Thread.Sleep(10000);
            process.WaitForInputIdle(15 * 1000);
            process.Kill();



在我的Web应用程序中,添加Web服务引用会调用此方法.
在Web应用程序中使用Web服务
错误:
System.Web.Services.Protocols.SoapException:服务器无法处理请求. ---> System.Exception:无法处理请求,因为该进程已退出.

我能知道我错了吗.
任何人都可以帮忙.

谢谢U.



In my web application add web service reference call this method not working.
consuming web services in web application
Error:
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Exception: Cannot process request because the process has exited.

Can I know were i wrong.
any one help out this.

Thank U.

推荐答案

原则上该如何工作?首先,您使用的是硬编码的文件路径名.无论您的应用程序是什么,即使它不是Web应用程序,也绝不会使用任何硬编码路径.这是使其仅在计算机上工作的一种方法.

更重要的是,您正在服务器端进行此操作.什么,Web用户单击某个控件,服务器计算机将打印出一些内容?服务器已连接到打印机? :-)您准备好打印用户可能开始打印的所有内容了吗?认真点吧.

—SA
How can it work, in principle? First, you are using a hard-coded file path name. No matter what your application is, even if it was not a Web application, there is no situations when using any hard-coded path can be used. This is a way to make it working only on your computer.

More importantly, you''re doing it on the server side. What, a Web user clicks on some control, and the server computer will print something? And the server is connected to a printer? :-) And you are ready to print everything the users might start to print? Do be serious.

—SA


使用Java脚本,我已经完成了
Using Java Script I have done this


这篇关于本地打印方法有效,但配置iis无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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