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.

LVL 14
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ptakjaAuthor Commented:
Thanks for the quick reply James. So how do I set the web service to run under a specific account?

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.


ptakjaAuthor Commented:
No luck. I put that line in with my credentials and retried my app.  Same thing. Also restarted IIS. Still nothing. :-(
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.