Seemingly no default printer for DLL invoked from WCF service user on IIS 7 and Windows Server 2008
I've got a WCF service that wraps some legacy DLLs that generate report PDFs. That legacy code works great in a desktop app, but when invoked via the WCF service, the PDF page size is driven by virtual screen size (the page size apsect ratio becomes 4:3) instead of an actual paper size.
I've exported the various registry keys for printers under my HKEY_CURRENT_USER and re-imported them under HKEY_USERS.DEFAULT, and I've made sure a local printer is available to "Everyone". Still the PDFs come out wrong.
The site is running in IIS 7 on Windows Server 2008.开发者_运维技巧 The site has its own 32-but AppPool, running as a specially created user. The site has Anonymous Authenticatione nabled and ASP.NET Impersonation disabled.
Oddly, if I make the AppPool run as myself, the report PDFs have a correct 8.5 x 11 in page size. But as soon as I make it the specially created used, the page size is 10.67 x 8.00 in (4:3 ratio, e.g. 1024x768).
What am I missing?
I'm not real familiar with WCF services, but if they're true Windows services then it's not surprising they don't see the default printer. They probably can't see network shares either. Simply running your service under a user account rather than the local system account should solve the problem.
精彩评论