Printing to a network printer from windows 2003 server fails...

S

Sai Vajja

Hi

I have a problem printing to a network printer from my VB.NET code component.
When i try printing to the network printer from my development PC all works
fine..
But, when i publish the code to the server and try the print, i get the
following message....

Settings to access printer '\\ServerName\MyNetworkPrinterName' are not valid.

When i try to change the spooler name to its IP, i still get the same error
message...

Settings to access printer '\\xx.xx.xx.xx\MyNetworkPrinterName' are not valid.



Here is a glimpse of the code behind the print...
m_DocumentPath = m_DocumentLocation & m_DocumentName

With m_pd
.PrinterSettings.PrinterName = m_PrinterName
.PrinterSettings.Copies = m_Copies
'.PrinterSettings.
AddHandler m_pd.PrintPage, New
System.Drawing.Printing.PrintPageEventHandler(AddressOf PrintImage)
m_pd.Print()
End With
 
N

Norman Yuan

What kind of application do you run in the server? A Win form app, Windows
service, or web application? It is possible the user account used to run the
application does not have access to the network resource (printer),
especially if it is a web app. If you absolutely need to print at server
side, you need to make sure the application runs under a user account that
has to permission to needed network resources.
 
S

Sai Vajja

Hi Norman

Sorry for not being very clear in my earlier post...
Here is the actual situation..

This is a ment to be a server based application and will be running as a
windows service.

It's purpose is basically to seperate out bulk printing and emailing from my
website.

I did get this doubt myself about user account and have tried to run the
service under various accounts (including an admin account..) but i still get
this same error.

I even tried all comnbinations of the \\server\printername with both ip
addresses and names.

The IT support guys here at my work said it could be something to do with
the printer drivers but i doubt that (what do you think?).

The service works fine when i test it from my development PC which is xp
professional. The server which will eventually host this app. is windows 2003
server...
 
F

ferhat karaca

exactly same problem at my project too..
additionally O wrote test program on winform with vb.net.
2003 server and printing on network printer works fine..
In my case webservice cannot send docment to networkprinter ..
Any help will be appriciated..
 
S

Sai Vajja

Hello All

Not sure if this is the solution but i finally got the printing to work....
Here is what i did.

I went on to the server (remote desktop) and added the printer i am trying
to test printing to manually to the printers. When i did that, it complained
about the printer drivers. So, i had to download the printer drivers and
install them and then add the printer. Once i did that, the printing started
working. I have not tried printing to any other printer on the company
network yet.. I hope i will not have to install all sorts of printer drivers
on this server just because it needs to print to different printers!!
If this is the case, i will be ending up with adding about 100+ printers on
this server and installing their drivers!!!!!!!!
Try this out and see if your troubles go away. But, if you find a neat
solution, please do let me know...

Regards
Sai Vajja.
 
F

ferhat karaca

Hi Again
I have solved the problem by adding impersonate line to web.config file of
the application.
This gives the permission to the application to access network printers.
I doubt about this was occured after windows security update.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top