转换为 Web 应用程序后,由较新的运行时错误构建的程序集

发布于 2024-12-06 22:37:00 字数 564 浏览 1 评论 0 原文

我最近正在将一个网站项目转换为一个网络应用程序项目。旧网站的 App_Code 文件夹中有一个 C# 文件,即使项目的其余部分是用 VB 编写的,该文件也能正常工作。由于我已将项目转换为 Web 应用程序,因此 .cs 文件将不再编译,因此我将 .cs 文件移动到其自己的项目中以编译为 .dll 并将其包含在解决方案中,以便它将单独编译。问题是,现在当我运行该网站时,我收到引用该 dll 的运行时错误:

该程序集是由比当前加载的运行时更新的运行时构建的,无法加载。

我无法降级 .cs 文件的 .net 框架,因为它使用 System.Web.Linq,该框架只能追溯到 3.5。当我尝试更改 Web 应用程序的框架时,它已经显示为 4.0(这对我来说毫无意义)。服务器的版本信息是:

版本信息:Microsoft .NET Framework 版本:2.0.50727.3623; ASP.NET版本:2.0.50727.3618

是否有办法在不更改服务器上的 .net 框架的情况下恢复旧功能?我只是缺少配置文件还是什么?

I've recently been converting a website project over to a web application project. The old website had a C# file in the App_Code folder which worked fine even though the rest of the project is in VB. Since I've converted the project to a web app, the .cs file will no longer compile, so I moved the .cs file to its own project to compile as a .dll and included it in the solution so it will compile seperately. The problem is that now when I run the site, I get a runtime error refering to that dll:

This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

I can't downgrade the .net framework of the .cs file because it uses System.Web.Linq, which only dates back to 3.5. When I try to change the framework of the web app it already shows up as 4.0 (which makes no sense to me). The version info for the server is:

Version Information: Microsoft .NET Framework Version:2.0.50727.3623; ASP.NET Version:2.0.50727.3618

Is there anyway to restore the old functionality without changing the .net framework on the server? Am I simply missing a configuration file or something?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

浊酒尽余欢 2024-12-13 22:37:00

在升级服务器之前,我会尝试将 C# 3.5 项目升级到 4.0。可能是当 C# 文件尝试与 Web 应用程序对话时发生错误。

编辑:更好的主意可能是将您的网络应用程序降级到 3.5。这样应用程序的两个部分都使用相同的版本,3.5 应该能够在 2.0 服务器上运行。

Before upgrading the server, I would try upgrading the C# 3.5 project to 4.0. Could be that the error is occurring when the C# file tries to talk back to the web app.

EDIT: A better idea might be to downgrade your web app to 3.5. That way both parts of the app are on the same version and 3.5 should be able to run on a 2.0 server.

香橙ぽ 2024-12-13 22:37:00

如果您将框架保持在 2.0,请尝试引用“System.Core”并确保“Copy Local”=true,或者手动将该文件移动到服务器。您还需要 .NET 2.0 SP1 才能完成这项工作。

If you keep the framework at 2.0, try referencing "System.Core" and make sure "Copy Local"=true or you move that file manually to the server. You will need .NET 2.0 SP1 as well to make this work.

上课铃就是安魂曲 2024-12-13 22:37:00

您可能需要更改运行网站的应用程序池正在使用的 .NET Framework 版本。确保服务器上安装了较新版本的框架,然后按照本页底部“将 IIS 应用程序与 IIS 7.0 中的 .NET Framework 4 关联”下的说明进行操作: http://msdn.microsoft.com/en-us/library/dd483478.aspx

You probably need to change the version of the .NET framework that the application pool running the website is using. Make sure that the newer version of the framework is installed on the server, then follow the instructions at the bottom of this page, under "To associate an IIS application with the .NET Framework 4 in IIS 7.0": http://msdn.microsoft.com/en-us/library/dd483478.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文