在远程虚拟机上使用刺激物报告

本文关键字:刺激物 报告 虚拟机 | 更新日期: 2023-09-27 18:12:41

我在MS Framework 4.0中编写了一个c#程序,使用StimulSoft Report 2010显示和打印一些报表。
我的程序在我的计算机上工作得很好,但是当我试图在远程虚拟计算机上运行它时,它有问题并给我这个错误:

Application: MyApplication.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.DirectoryNotFoundException
Stack:
at Stimulsoft.Report.StiReport.Load(System.String)
at Tavanmand.StoneCut.ManagementApplication.SlabForm.PrintForm(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject, System.Windows.RoutedEventArgs, System.Windows.RoutedEvent)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunInternal(System.Windows.Window)
at System.Windows.Application.Run()
at Tavanmand.StoneCut.ManagementApplication.App.Main()

我只是程序的这一部分有问题。其他部分工作良好。
我一直在myApplication.exe附近添加所有的刺激物报告dll文件,甚至安装刺激物报告2010,但它仍然不工作。

我现在该怎么办?

在远程虚拟机上使用刺激物报告

堆栈跟踪中的最后一个调用是当您尝试加载报告文件时。(捷运)。

这似乎是一个明显的迹象,表明您没有正确设置搜索报告文件的文件夹,因此您得到异常

Directory Not Found

对于你的第二条评论,绝对可以。
您需要重新分发项目所需的DLL。如果您查看编程手册,您会发现专门用于程序集重新分配的部分。它们会根据你的项目类型而变化。(Section 21.12 Redistributable files in Reports.Net)

刺激性软件文件可以简单地复制到您安装应用程序的同一文件夹中。当然,您也可以将它们添加到目标机器的GAC中。但我觉得把它们复制到应用程序的同一文件夹更简单