با سلام
در زمانی که در ویژوال استدیو از استیمول سافت استفاده می کنم بدون هیچ مشکلی پرینت انجام می شود اما وقتی فایل پابلیش شده رو استفاده می کنم با ارور زیر مواجه می شم
متن خطا را قرار دهید.
Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application
[InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.] System.Windows.Forms.Form.ShowDialog(IWin32Window owner) +1780 Stimulsoft.Base.StiExceptionProvider.Show(Exception exception) +142 Stimulsoft.Report.Print.StiPrintProvider.Print(StiReport report, Boolean showPrintDialog, Int32 fromPage, Int32 toPage, Int16 copies, PrinterSettings printerSettings) +3042 Stimulsoft.Report.StiReport.Print(Boolean showPrintDialog, Int32 fromPage, Int32 toPage, Int16 copies, PrinterSettings printerSettings) +470 Stimulsoft.Report.StiReport.Print() +56 Setad.InfraStructure.StimulLetter.Letter(String type, String id, String mounth, String day, String place, String replynumber, String dateEnd, String dateStart, String dateletter) +8894 Setad.SetUnitSoldier.btnPresubmit_OnClick(Object sender, EventArgs e) +235 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11773405 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5062
از MessageBox یا مشابه آن استفاده کرده اید ؟
خیر
public void Letter(string type,string id,string mounth,string day,string place,string replynumber,string dateEnd,string dateStart,string dateletter) { var personels = _db.Personels.FirstOrDefault(u => u.PersonelNumber == id); if (personels!=null) { string title = place; string father = personels.FatherName; string personel = personels.PersonelNumber; string soldiers = personels.Stripe.StripName + " وظیفه" + " " + personels.Name + " " + personels.Family; var now = PersianDateTime.Now; var today = now.ToString(PersianDateTimeFormat.Date); dateletter =(dateletter == string.Empty) ? today : dateletter; var rpt = new Stimulsoft.Report.StiReport() rpt.Load(_p.Server.MapPath(type));
rpt.print();
این بخشی از کد هست
report.Print(showPrintDialog: false); در publish خطای زیر را می دهد.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.]
System.Windows.Forms.Form.ShowDialog(IWin32Window owner) +1850
Stimulsoft.Base.StiExceptionProvider.Show(Exception exception) +140
Stimulsoft.Report.Print.StiPrintProvider.Print(StiReport report, Boolean showPrintDialog, Int32 fromPage, Int32 toPage, Int16 copies, PrinterSettings printerSettings) +3003
Stimulsoft.Report.StiReport.Print(Boolean showPrintDialog, Int32 fromPage, Int32 toPage, Int16 copies, PrinterSettings printerSettings) +443
Stimulsoft.Report.StiReport.Print() +56
Working.Controllers.WorkSanadsController.GetReport(Int32 id) +1778
System.Web.Mvc.<>c__DisplayClass1.<WrapVoidAction>b__0(ControllerBase controller, Object[] parameters) +15
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +229
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +67
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +72
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +386
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
هیچ کاربری تا کنون از این پست تشکر نکرده است
با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)