简体   繁体   English

ASP.NET 3.5 Web站点默认情况下停止导入System命名空间

[英]ASP.NET 3.5 Web Site stopped importing System namespace by default

I have a VB Web Site project that has recently (and mysteriously) stopped importing the "System" namespace by default. 我有一个VB Web站点项目,最近(并且神秘地)默认情况下停止导入“System”命名空间。

I'm having to either place an Imports System line at the top of each code behind, or preface everything with System , which is fairly annoying, not to mention redundant. 我不得不在每个代码的顶部放置一个Imports System系列,或者将所有内容添加到System ,这非常烦人,更不用说冗余了。 I can't for the life of me figure out how to get the System namespace back to being imported by default. 我不能为我的生活弄清楚如何将System命名空间恢复为默认导入。

I've already checked to see that WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\CONFIG\\web.config contains the <add namespace="System"/> line--it does. 我已经检查过WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\CONFIG\\web.config包含<add namespace="System"/>行 - 它确实如此。 That was my best lead. 那是我最好的领导。

I have references to several namespaces within the System namespace in the <assemblies> node (eg System.Design , System.Web.Extensions of my website's web.config. There is no <namespaces> node. This has not been changed recently. 我在<assemblies>节点的System命名空间中引用了几个名称空间(例如我的网站web.config的System.DesignSystem.Web.Extensions 。没有<namespaces>节点。最近没有更改过。

I'm tearing my hair out. 我正在撕扯我的头发。 Does anyone have any suggestions? 有没有人有什么建议?

This seems to have fixed itself as mysteriously as it broke in the first place. 这似乎已经把它自己固定为神秘的,因为它首先打破了。 I'm not sure what I did, but it's working now. 我不确定我做了什么,但它现在正在运作。 So it goes. 就这样吧。

Just been through this with a VB Web Project in VS 2013. 刚刚通过VS 2013中的VB Web项目完成了这项工作。

Lots of cases of the error from types in the System, System.Collections 1 , … 很多来自System,System.Collections 1中的类型的错误案例,......

Turns out when copying a <configSections> element into the web.config (as part of adding some better logging) I'd copied the surrounding <configuration> element in as well. 在将<configSections>元素复制到web.config (作为添加更好的日志记录的一部分)我也复制了周围的<configuration>元素。

Lots of weirdness followed. 随之而来的是很多怪异。 Was able to find issue when I found I could get the site to run and the IIS error page told me I had a configuration error. 当我发现我可以让网站运行时,能够找到问题,IIS错误页面告诉我,我有一个配置错误。

Now to redo all the changes I had undone on my way to finding that…. 现在重做我在发现那条路上时所取消的所有变化......


1 The wonders of legacy code maintenance. 1遗留代码维护的奇迹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM