Printing from a Web Method

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?TWFyazYyNA==?=

    #1

    Printing from a Web Method

    I have a web method that renders a SQL Reporting Services report and prints
    it to a network printer using the System.Drawing and System.Drawing. Printing
    namespaces in .Net 2.0. This method has been working without issues in
    production at several client sites but now I've started seeing memory errors
    when trying to print. The only way to resolve the errors has been to do an
    IISReset on the web server hosting the web service. I tried calling
    Microsoft support for assistance in troubleshooting the issue and found out
    that using System.Drawing in an ASP.Net application, ASP.Net Web Service and
    in a Windows Service is not supported. Does anyone have any alternative ways
    to print from a web service to a network printer? I'm trying to find a
    managed code way of doing this but I'm not finding anything but
    System.Drawing. Printing.

    Thanks for the help.

    Mark
  • John Saunders [MVP]

    #2
    Re: Printing from a Web Method

    "Mark624" <Mark624@discus sions.microsoft .comwrote in message
    news:6BA1F804-2E52-4B1D-A578-FE73137CFBCF@mi crosoft.com...
    >I have a web method that renders a SQL Reporting Services report and prints
    it to a network printer using the System.Drawing and
    System.Drawing. Printing
    namespaces in .Net 2.0. This method has been working without issues in
    production at several client sites but now I've started seeing memory
    errors
    when trying to print. The only way to resolve the errors has been to do
    an
    IISReset on the web server hosting the web service. I tried calling
    Microsoft support for assistance in troubleshooting the issue and found
    out
    that using System.Drawing in an ASP.Net application, ASP.Net Web Service
    and
    in a Windows Service is not supported. Does anyone have any alternative
    ways
    to print from a web service to a network printer? I'm trying to find a
    managed code way of doing this but I'm not finding anything but
    System.Drawing. Printing.
    My suggestion would be to not print from a Web Service! Instead, write a
    Windows Service, and queue the request to the Windows Service.

    Unless you are printing asynchronously, you are tying up a worker thread for
    as long as it takes to print the file over the network. I hope you don't get
    too many simultaneous requests!
    --
    John Saunders [MVP]

    Comment

    • =?Utf-8?B?TWFyazYyNA==?=

      #3
      Re: Printing from a Web Method

      Hi John,

      Thanks for the response! The thought of using a Windows Service crossed my
      mind too as an alternate but that is not supported either. Any other
      thoughts? My only other idea so far is to write a console application that
      does the printing and have my web method start the console app with the
      appropriate parameters. It just seems like there has to be a better way.

      Thanks for any ideas!

      Mark

      Comment

      • John Saunders [MVP]

        #4
        Re: Printing from a Web Method

        "Mark624" <Mark624@discus sions.microsoft .comwrote in message
        news:3F9E4149-7D8C-41B9-8827-1B98980B5B9D@mi crosoft.com...
        Hi John,
        >
        Thanks for the response! The thought of using a Windows Service crossed
        my
        mind too as an alternate but that is not supported either. Any other
        thoughts? My only other idea so far is to write a console application
        that
        does the printing and have my web method start the console app with the
        appropriate parameters. It just seems like there has to be a better way.
        Another set of alternatives would be to use either .NET Remoting or Windows
        Communications Framework (WCF) to talk to a "Windowless " Windows Forms
        application. This would be a normal Winforms application except that it
        would not display its form. Both Remoting and WCF can be hosted in this sort
        of application.

        The question for your Microsoft contacts is whether or not the window is
        required for printing to be supported, or if it only needs to be in a
        Windows Forms application.
        --
        John Saunders [MVP]

        Comment

        Working...