WPF CrystalReport崩溃

问题描述

当我尝试运行这段代码时,应该将crystalreport文件打印到CrystalReportview,它可以在本地开发环境中运行,但是在客户服务器上运行时会崩溃。我已经尝试解决此问题已有4天了,但是没有运气,请帮助我丢失的内容

  public void Load(bool test)
        {
            try
            {
                CrystalReportsViewer1.Owner = Window.Getwindow(this);
                rpt = new ReportDocument();         
                var res = reportService.GetReport(mediePlanNr,version);
                string currentDirectory = Environment.CurrentDirectory;
                ConnectionInfo connectionInfo = null;
                if (Environment.MachineName.ToString().Equals("DESKTOP-J9R50CS"))                {
                    connectionInfo = new ConnectionInfo()
                    {
                        ServerName = "DESKTOP-J9R50CS",IntegratedSecurity = true,DatabaseName = "DiMPdotNetDev",};
                }
                else
                {
                    connectionInfo = new ConnectionInfo()
                    {
                        ServerName = "DLU09",DatabaseName = "DiMPdotNetDev"
                    };
                }
                if (test)
                {
                    if (status < 6)
                    {

                        if (miljøtillæg)
                        {
                            rpt = new LokalPlanner.Reports.MedieplanMedOplagMedTillæg();
                            filePath = System.IO.Path.Combine(currentDirectory,"Reports","MedieplanMedOplagMedTillæg.rpt");
                            rpt.Load(filePath);
                            SetDataBaseConncetion(rpt,connectionInfo);
                        }
                        else
                        {
                            rpt = new LokalPlanner.Reports.MedieplanMedOplagUdenTillæg();
                            filePath = System.IO.Path.Combine(currentDirectory,"MedieplanMedOplagUdenTillæg.rpt");
                            rpt.Load(filePath);
                            SetDataBaseConncetion(rpt,connectionInfo);
                        }
                        if (BilagUdenLæsertal.IsChecked.Value && bilagUdenPostnr.IsChecked.Value)
                        {
                            rpt = new LokalPlanner.Reports.BilagUdenLæsertalMedPostNr();
                            filePath = System.IO.Path.Combine(currentDirectory,"BilagUdenLæsertalMedPostNr.rpt");
                            SetDataBaseConncetion(rpt,connectionInfo);
                            rpt.Load(filePath);
                        }
                        else if (BilagUdenLæsertal.IsChecked.Value && BilagMedPostNr.IsChecked.Value)
                        {
                            rpt = new LokalPlanner.Reports.BilagUdenLæsertalMedPostNr();
                            filePath = System.IO.Path.Combine(currentDirectory,"BilagUdenLæsertalMedPostNr.rpt");
                            rpt.Load(filePath);
                            SetDataBaseConncetion(rpt,connectionInfo);
                        }
                        else if (BilagMedLæserTal.IsChecked.Value && bilagUdenPostnr.IsChecked.Value)
                        {
                            rpt = new LokalPlanner.Reports.BilagMedLæsertalUdenPostNr();
                            filePath = System.IO.Path.Combine(currentDirectory,"BilagMedLæsertalUdenPostNr.rpt");
                            rpt.Load(filePath);
                            SetDataBaseConncetion(rpt,connectionInfo);
                        }
                        else if (BilagMedLæserTal.IsChecked.Value && BilagMedPostNr.IsChecked.Value)
                        {
                            rpt = new LokalPlanner.Reports.BilagMedLæsertalMedPostNr();
                            filePath = System.IO.Path.Combine(currentDirectory,"BilagMedLæsertalMedPostNr.rpt");
                            rpt.Load(filePath);
                            SetDataBaseConncetion(rpt,connectionInfo);
                        }
                        if (status == 6)
                        {

                            if (res.InvoiceType == 0)
                            {
                                rpt = new LokalPlanner.Reports.FakturaBilag2InclAnnoncekontrolFejl();
                                filePath = System.IO.Path.Combine(currentDirectory,"FakturaBilag2InclAnnoncekontrolFejl.rpt");
                                rpt.Load(filePath);
                                SetDataBaseConncetion(rpt,connectionInfo);

                            }
                            else
                            {
                                rpt = new LokalPlanner.Reports.FakturaBilag2InclAnnoncekontrolFejl();
                                filePath = System.IO.Path.Combine(currentDirectory,"FakturaBilag2InclAnnoncekontrolFejl.rpt");

                                rpt.Load(filePath);
                                SetDataBaseConncetion(rpt,connectionInfo);
                            }

                        }
                        else
                        {
                            if (res.InvoiceType == 0)
                            {
                                rpt = new LokalPlanner.Reports.FakturaBilagInclFaktureringsFejl();
                                filePath = System.IO.Path.Combine(currentDirectory,"FakturaBilagInclFaktureringsFejl.rpt");
                                rpt.Load(filePath);
                                SetDataBaseConncetion(rpt,connectionInfo);
                            }
                            else
                            {
                                rpt = new LokalPlanner.Reports.FakturaBilag2InclFaktureringsFejl();
                                filePath = System.IO.Path.Combine(currentDirectory,"FakturaBilag2InclFaktureringsFejl.rpt");
                                rpt.Load(filePath);
                                SetDataBaseConncetion(rpt,connectionInfo);
                            }
                        }
                    }
                }               
                  rpt.SetParameterValue("MedieplanNrParam",mediePlanNr);
                 rpt.SetParameterValue("VersionParam",version);
                CrystalReportsViewer1.ViewerCore.ReportSource = rpt;
                //CrystalReportsViewer1.ViewerCore.Zoom(1);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.HelpLink);
            }
        }

I get this stacktrace

ved LokalPlanner.faktureing.RapportVisning.Load(布尔值) ved System.Windows.EventRoute.InvokeHandlersImpl(System.Object,System.Windows.RoutedEventArgs,布尔值) ved System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject,System.Windows.RoutedEventArgs) ved System.Windows.Controls.Primitives.ButtonBase.OnClick() ved System.Windows.Controls.Button.OnClick() ved System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs) ved System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate,System.Object) ved System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object,System.Windows.RoutedEventArgs) ved System.Windows.EventRoute.InvokeHandlersImpl(System.Object,System.Windows.RoutedEventArgs,布尔值) ved System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject,System.Windows.RoutedEventArgs,System.Windows.RoutedEvent) ved System.Windows.UIElement.onmouseupThunk(System.Object,System.Windows.Input.MouseButtonEventArgs) ved System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate,System.Object) ved System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object,System.Windows.RoutedEventArgs) ved System.Windows.EventRoute.InvokeHandlersImpl(System.Object,System.Windows.RoutedEventArgs,布尔值) ved System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject,System.Windows.RoutedEventArgs) ved System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs) ved System.Windows.Input.InputManager.ProcessstagingArea() ved System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs) ved System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport) ved System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr,System.Windows.Input.InputMode,Int32,System.Windows.Input.RawMouseActions,Int32,Int32,Int32) ved System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr,MS.Internal.Interop.WindowMessage,IntPtr,IntPtr,布尔ByRef) ved System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr,Int32,IntPtr,IntPtr,布尔ByRef) ved MS.Win32.HwndWrapper.WndProc(IntPtr,Int32,IntPtr,IntPtr,布尔ByRef) ved MS.Win32.HwndSubclass.dispatcherCallbackOperation(System.Object) ved System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate,System.Object,Int32) ved System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object,System.Delegate,System.Object,Int32,System.Delegate) ved System.Windows.Threading.dispatcher.LegacyInvokeImpl(System.Windows.Threading.dispatcherPriority,System.TimeSpan,System.Delegate,System.Object,Int32) ved MS.Win32.HwndSubclass.SubclassWndProc(IntPtr,Int32,IntPtr,IntPtr) ved MS.Win32.UnsafeNativeMethods.dispatchMessage(System.Windows.Interop.MSG ByRef) ved System.Windows.Threading.dispatcher.PushFrameImpl(System.Windows.Threading.dispatcherFrame) ved System.Windows.Window.ShowHelper(System.Object) ved System.Windows.Window.ShowDialog() ved LokalPlanner.MediePlan.udskriv_Click(System.Object,System.Windows.RoutedEventArgs) ved System.Windows.EventRoute.InvokeHandlersImpl(System.Object,System.Windows.RoutedEventArgs,布尔值)

ved WpfApp4.App.Main()


解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)