문제

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 :)

도움이 되었습니까?

해결책

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top