c# - System.ComponentModel.Win32Exception (0x80004005): Server RPC unavailable -
sorry duplicate, have situation. have little program realize printpreview , print processes.
private void printdocument1_printpage(object sender, system.drawing.printing.printpageeventargs e) { e.graphics.drawstring("hello world", new font("times new roman", 16, fontstyle.bold), brushes.black, 10, 10); } private void button1_click(object sender, eventargs e) { string str = ""; (int = 0; < printersettings.installedprinters.count; i++) { str += printersettings.installedprinters[i] + "\n"; } messagebox.show(str); try { printpreviewdialog1.document = printdocument1; printersettings prnset = new printersettings(); if (printersettings.installedprinters.count > 0) { pagesettings ps = new pagesettings(prnset); ps.margins.left = 10; ps.margins.right = 20; ps.margins.top = 10; ps.margins.bottom = 20; printpreviewdialog1.showdialog(); } } catch (exception ex) { messagebox.show(ex.tostring()); } } private void button2_click(object sender, eventargs e) { printdialog1.document = printdocument1; printdialog1.showdialog(); }
when run vs works, when run release folder - exception:
system.componentmodel.win32exception (0x80004005): server rpc unavailable @ system.drawing.printing.printersettings.get_installedprinters() @ printstudy.form1.button1_click(object sender, eventargs e) in c:\printstudy\form1.cs:line 37 @ system.windows.forms.control.onclick(eventargs e) @ system.windows.forms.button.onclick(eventargs e) @ system.windows.forms.button.onmouseup(mouseeventargs mevent) @ system.windows.forms.control.wmmouseup(message& m, mousebuttons button, int32 clicks) @ system.windows.forms.control.wndproc(message& m) @ system.windows.forms.buttonbase.wndproc(message& m) @ system.windows.forms.button.wndproc(message& m) @ system.windows.forms.control.controlnativewindow.onmessage(message& m) @ system.windows.forms.control.controlnativewindow.wndproc(message& m) @ system.windows.forms.nativewindow.callback(intptr hwnd, int32 msg, intptr wparam, intptr lparam)
i tried restart printer spooling process no result. (user has admin privileges).
p.s. setup debug->exceptions check in thrown in vs vs shows me exceptions during debugging, vs started program without problems. why problems appear when run release/debug folder? , how solve it?
Comments
Post a Comment