Linq代码在aspx页面中无法编译(IIS 10/.ASP .NET 4.7.2)
Linq代码在aspx页面中无法编译(IIS 10/.ASP .NET 4.7.2)
首先,对不起 - 我不是C#或asp开发人员,但我知道足够的知识来处理。我继承了一些在我们网站上开发的aspx页面,但这些页面是由已经离职的人开发的。这些页面在IIS 7.5上的Windows 2012和ASP .NET 4.5上运行多年来一直正常工作。我们最近升级到了IIS 10、Windows 2016和ASP .NET 4.7.2。这两个页面就像以前一样工作,除非它们调用LINQ函数。如果我将该代码注释掉,页面会正常工作(没有LINQ函数的情况下)。\n我想要理解的是,缺少什么会导致它们失败。由于公司限制,我无法访问Visual Studio,所以无法进行远程调试。我一直在试图通过注释掉代码来缩小问题的范围来解决这个问题。只要我取消注释LINQ调用,它就会失败。根据下面的堆栈跟踪,似乎缺少某些导致它无法编译的东西。根据我所知,我有之前的所有DLL。我搜索了其他线程,但它们似乎都在讨论更新VS项目的问题。我没有VS,只有一个aspx页面,在先前的IIS和ASP .NET版本中工作正常。\n
异常信息: 异常类型:HttpCompileException 异常消息:c:\inetpub\wwwroot\STPUserComapre.aspx(187): error CS0012: 类型“System.Object”在一个未引用的程序集中定义。您必须添加对程序集“System.Runtime,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”的引用。 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.ExecuteStepImpl(IExecutionStep step) at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)