【问题标题】:Classes in a web application dll crashWeb 应用程序 dll 崩溃中的类
【发布时间】:2010-06-23 08:24:34
【问题描述】:

我将一个 ASP.Net 网站转换为 ASP.Net Web 应用程序,并将框架从 2.0 更改为 3.5

Web 应用程序在 Visual Studio 中运行良好。但是,如果我在 dll 中编译应用程序,并尝试在另一个 Web 项目中重用其中间层,则所有具有静态变量的类都会崩溃。代码如下:

public static string myString = "Something";

但是,如果我将其转换为这样的属性:

public static string myString {get{return "Something";}}

,它的工作原理。谁知道原因?

【问题讨论】:

    标签: c# asp.net dll web-applications


    【解决方案1】:

    我可能弄错了,但我认为这是因为静态变量在编译时被实习。

    您在使用之前是否重新编译了其他 Web 项目?这可能是原因。 (但同样,我不确定)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-31
      • 2013-12-17
      • 2013-10-13
      • 1970-01-01
      • 2013-08-09
      • 2018-09-07
      • 1970-01-01
      • 2017-01-03
      相关资源
      最近更新 更多