Frage

I have a web application hosted on server 'A' (SA) and a web service for printing hosted on server 'B' (SB). SA creates and image that needs printing and sends it to SB. When doing this, printing is fairly slow, around fifteen seconds. However, if I log into SB using remote desktop as the user from the webconfig of the app hosted on SA, then it will print in less than two seconds. It seems as if SB is starting something up when I log into it that is making it print faster. Any idea what this could be and if there's a way that I could keep this printing fast even if I'm not logged in?

Edit: Size of the image being printed is about 20 KB.

Here's the code from of the service that is hosted on SB:

public void PrintImage(Stream printImage, string printServer, string printer)
    {
        string printerName = String.Format(@"\\{0}\{1}", printServer, printer);

        Image image = Image.FromStream(printImage);

        PrintDocument printDocument = new PrintDocument();
        PrinterSettings settings = new PrinterSettings();
        settings.PrinterName = printerName;
        printDocument.PrinterSettings = settings;

        printDocument.PrintPage += (s, e) =>
        {
            e.Graphics.DrawImage(image, 0, 0);
        };

        printDocument.Print();
    }

Thanks for taking time to read through this :)

War es hilfreich?

Lösung

We found that if we created a printer mapping on SB, it would execute just as fast without a remote desktop connection.

Andere Tipps

Note that printing from a web app (or a service) is generally unsupported. see msdn and this SO post.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top