0

Below code is working in Console/Windows Application also its working in web applications when I'm running the application through Web Development Server

  ProcessStartInfo gsProcessInfo;
  Process gsProcess;
  gsProcessInfo = new ProcessStartInfo();
  gsProcessInfo.Verb = "PrintTo";
  gsProcessInfo.WindowStyle = ProcessWindowStyle.Hidden;
  gsProcessInfo.FileName = (string)filePath;
  gsProcessInfo.Arguments = "\"" + printerName + "\"";
  gsProcess = Process.Start(gsProcessInfo);
  gsProcess.WaitForExit(-1);

Problem

When I'm hosting my web application in IIS , the process is waiting infinitely. I googled and found that the issue might be related to permissions and followed the solutions given there but no luck.

Following are the configurations of my hosted application

Application Pool

enter image description here

enter image description here

Guide me what else is required or what I'm doing wrong

Rishi Tiwari
  • 1,041
  • 1
  • 10
  • 20
  • Have you checked if "MyPool" identity is not "ApplicationPoolIdentity" (default value)? If so, you should try to change the default identity with a user. – Francesco Milani Jun 01 '17 at 05:41
  • Can you elaborate a bit..as how to do waht you are suggesting – Rishi Tiwari Jun 01 '17 at 05:44
  • Click on Test Settings and check if there are 2 green indicators if yes then you have permissions – Samvel Petrosov Jun 01 '17 at 05:48
  • @S.Petrosov yes its showing two green indicators...but still not working – Rishi Tiwari Jun 01 '17 at 06:01
  • Test Settings checks for the application path.. I'm guessing your problem it's related to "filePath". By the print screen provided I can see you're using "MyPool" so what I was suggesting to check is: go to ApplicationPools root, mouse right button on MyPool, Advanced Settings then check for Identity – Francesco Milani Jun 01 '17 at 06:22
  • @FrancescoMilani did what you suggested and updated my post with the image also..still no luck – Rishi Tiwari Jun 01 '17 at 08:38
  • What I suggested is that you need to change ApplicationPoolIdentity with a user with enough privileges. – Francesco Milani Jun 01 '17 at 09:27
  • @FrancescoMilani : did what you suggested MyPool->AdvanceSetting->Identity->Custom Account.. used the User who has admin privileges...still no luck – Rishi Tiwari Jun 02 '17 at 05:54

0 Answers0