IIS and Printing
-
Hi, I develop a web application and when click a print button it print direct to the default printer and it's work fine, but when I publish the application on the IIS the print doesn't work. error is : Object reference not set to an instance of an object. Please let me know how to configure the IIS and Print permission becasuse we think the problem is in the permission. Thanks
-
Hi, I develop a web application and when click a print button it print direct to the default printer and it's work fine, but when I publish the application on the IIS the print doesn't work. error is : Object reference not set to an instance of an object. Please let me know how to configure the IIS and Print permission becasuse we think the problem is in the permission. Thanks
So you're trying to access the default printer from C#, which means that your application is trying to print on the server. If you're trying to print on the client side, you'll need to do it in the client-side language, namely JavaScript (window.print()). This sort of things often "works" in a development environment, where the server and client are normally the same machine. In the cloud, though, servers are generally VMs with no printer setup. If a printer was setup you wouldn't see an error message: the document would simply print at the server's default printer, and only the IPP admins know where that is.
"There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli
-
So you're trying to access the default printer from C#, which means that your application is trying to print on the server. If you're trying to print on the client side, you'll need to do it in the client-side language, namely JavaScript (window.print()). This sort of things often "works" in a development environment, where the server and client are normally the same machine. In the cloud, though, servers are generally VMs with no printer setup. If a printer was setup you wouldn't see an error message: the document would simply print at the server's default printer, and only the IPP admins know where that is.
"There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli
NB: In Windows, printers are installed and configured per user. Even if the server admin installed and configured a printer under the administrator account, it wouldn't be available to the server account(s) under which IIS applications run. Getting the printer configured on the server for IIS would involve manipulating the registry.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
NB: In Windows, printers are installed and configured per user. Even if the server admin installed and configured a printer under the administrator account, it wouldn't be available to the server account(s) under which IIS applications run. Getting the printer configured on the server for IIS would involve manipulating the registry.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Richard Deeming wrote:
Getting the printer configured on the server for IIS would involve manipulating the registry.
Or just changing the App Pool to run with an account that does have a printer setup? Still, probably not a good idea.
There are only 10 types of people in the world, those who understand binary and those who don't.
-
NB: In Windows, printers are installed and configured per user. Even if the server admin installed and configured a printer under the administrator account, it wouldn't be available to the server account(s) under which IIS applications run. Getting the printer configured on the server for IIS would involve manipulating the registry.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Richard Deeming wrote:
Getting the printer configured on the server for IIS would involve manipulating the registry.
Or GPO and a print server. I guess environment does have a big impact on worldview.
"There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli
-
So you're trying to access the default printer from C#, which means that your application is trying to print on the server. If you're trying to print on the client side, you'll need to do it in the client-side language, namely JavaScript (window.print()). This sort of things often "works" in a development environment, where the server and client are normally the same machine. In the cloud, though, servers are generally VMs with no printer setup. If a printer was setup you wouldn't see an error message: the document would simply print at the server's default printer, and only the IPP admins know where that is.
"There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli