• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 337
  • Last Modified:

Printing From Web Service

I  have been pulling my hair out on this one for quite some time...any help would be appreciated!

I have a web service running on a Win 2000 Advanced Server. The service needs to print something on command from the client application to a NETWORK printer.

For some reason, when we send the print job, nothing happens. That is, no errors, nothing in the printer's queue, nothing.
I CAN print from the server using Notepad. So I know the printer works and the server can talk to it.

THe printer we are trying to print to is configured as the Default printer, and the printer is configured to allow Everyone to print from it.

One thing that I am thinking is that when noone is logged into the server, how do you configure a printer as the default for that case?  That is, when I login into the server, and set up a printer, I assume that it is setup for my user profile. But what happens when I log off and noone is logged in? How can I set the printer up for that case?

I also tried setting up a LOCAL printer that is mapped to the network port. We had success with this when developing the webservice on another PC using LocalHost for the server. But since we moved the code to a production web server...nothing.

HELP!
0
ptakja
Asked:
ptakja
  • 2
  • 2
1 Solution
 
james-ct16Commented:
Hi
This is probably a security problem, is the webservice running under the default account becuase this has no network access permissions by default. what you need to do is either set the webservice to run under an account with access to the network or you could set up impersonation for either the webservice or just the few lines of code to print. the later is far harder.
This error would be consistent with the user being able to print and the webservice not as they use different accounts.

hope that is of some help

james
0
 
ptakjaAuthor Commented:
Thanks for the quick reply James. So how do I set the web service to run under a specific account?
0
 
james-ct16Commented:
hi

if you add the following line to teh web.config file, this will set up impessonation for the entire section of code that web.config file is valid for.

<identity impersonate="true" userName="[domain / machine name]\[username]" password="[password]"/>

disadvantage is that you have to have the password in plain text, unless someone knows of a way not to. Having said that iis will not let users download .config files it returns a 404.

Im afraid i dont have the code to hand for setting up 'inline' impersonation, might be worth a quite search of msdn.

but if you set that up the impersonation as above as prove of concept you will at least be able to finger or eliminate the security issue.

regards

james
0
 
ptakjaAuthor Commented:
No luck. I put that line in with my credentials and retried my app.  Same thing. Also restarted IIS. Still nothing. :-(
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now