Asp.net Dev Server 使用了错误版本的框架?

发布于 2024-07-13 18:15:53 字数 557 浏览 4 评论 0原文

目前正在使用 VS2008 开发 ASP.NET WebApplication。 我停止了几周的开发,当我回来时,我的项目出现了以下问题:

整个项目编译良好(全部针对Framework3.5SP1)。 但是,当我启动它(使用 ASP.NET 开发服务器)时,我收到一条消息(从浏览器),提示存在编译错误“编译器错误消息:CS0234:类型或命名空间名称“DirectoryServices”不存在于命名空间“系统”(是否缺少程序集引用?)”

在错误页面的底部,版本信息: 版本信息:Microsoft .NET Framework版本:2.0.50727.3053; ASP.NET 版本:2.0.50727.3053

服务器正在使用 .NET Framework 版本 2? 但我所有的项目都是针对 3.5

有没有一个简单的方法来防止这种情况发生?

我应该补充一点:

重新安装.net框架版本3.5 + sp1,仍然是同样的问题。 这里需要注意的是,我没有使用完整的 IIS,只是使用 VS2008 提供的“Asp.net 开发服务器”。 (CTRL + F5/启动)

Currently developing an ASP.NET WebApplication with VS2008. I stopped development for a few weeks, and when I came back, my project is exhibiting the following problem:

The whole project compiles fine (all targeted to Framework3.5SP1). However, when I launch it (with ASP.NET Development Server), I get a message (from the browser) that there was a compilation error "Compiler Error Message: CS0234: The type or namespace name 'DirectoryServices' does not exist in the namespace 'System' (are you missing an assembly reference?)"

At the bottom of the error page, the version information:
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

The server is using .NET Framework Version 2? But all my projects are targetted to 3.5

Is there a simple way to prevent this from happening?

I should add:

re-installed .net framework version 3.5 + sp1, still same issue. important to note here is that i'm not using full blown IIS, just the "Asp.net development server" supplied with VS2008. (CTRL + F5/Launch)

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

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

发布评论

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

评论(3

孤云独去闲 2024-07-20 18:15:53

原因是 .NET 3.5 不是像 v2.0 或 v1.1 那样的独立框架。 它只是2.0框架的扩展。 该扩展为开发人员提供了新的语言功能,例如匿名类型、扩展方法、Lambda 表达式,当然还集成了 LINQ .... 和 AJAX。
因此您只需在 IIS 中使用 2.0。

您应该尝试在该服务器上安装 .NET Framework 3.5,IIS 服务器将自动使用正确的版本。

The reason being .NET 3.5 is not a stand alone framework like v2.0 or v1.1 . It is just an extension of the 2.0 framework. The extension provides developers with new language features like Anonymous Types, Extension Methods, Lambda Expressions and of course LINQ .... and AJAX is now integrated.
Therefore you just use 2.0 in IIS.

You should try to install .NET Framework 3.5 on that server, the IIS server will automatically use the correct version.

月寒剑心 2024-07-20 18:15:53

这里只是猜测。 是否您的开发计算机或服务器其中一台已升级到 .Net 3.5 SP1,而另一台尚未升级?

Just guessing here. Could it be that one of either your development machine or the server has upgraded to .Net 3.5 SP1 while the other has not?

今天小雨转甜 2024-07-20 18:15:53

您的机器 web.config 可能引用的是 2.0。 您可以通过IIS管理控制台将其重新配置为3.5。 或者您可以修改<程序集>; 在 web.config 中添加元素 并明确指定<添加程序集> 对于每个 3.5 组件。

Chances are you machine web.config is referencing 2.0. You can reconfigure it to 3.5 through IIS management console. Or you can modify the <assemblies> element in your web.config to add <clear /> and explixitly specify <add assembly> for each 3.5 assembly.

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