我们将一个 asp.net 网站从2008R2 Windows和SQL Server服务器复制到装有SQL Server 2016的Windows 2016服务器,当我们尝试从浏览器打开网站时,它失败并显示以下错误和堆栈跟踪。
Message: E:sharedappsRepairTrakAbout.aspx.vb(19): error BC30002: Type 'ReportExecutionService' is not defined.
Stack Trace:
at System.Web.Compilation.AssemblyBuilder.Compile()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
下面是名为 About.aspx 的整个代码隐藏页,该页将引发错误。
Imports Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution
关于分部类 继承页面
Private Sub About_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim virtualFolderPath As String = "~/Photos/_Rotated/"
'Get information about the files in the specified folder
Dim strPhysicalPath As String = Server.MapPath(virtualFolderPath)
strPhysicalPath &= "IMG_061749.JPG"
'Get information about the image
'Dim currentImage As System.Drawing.Image = System.Drawing.Image.FromFile(strPhysicalPath)
ImageRounded.ImageUrl = strPhysicalPath
ImageThumb.ImageUrl = strPhysicalPath
' ReportExecution object prepare
Dim rs As New ReportExecutionService()
End Sub
结束类
原来我不得不在新服务器上安装 ReportViewer 运行时 exe。