【发布时间】:2015-05-11 06:23:35
【问题描述】:
我有相同的代码,它们在 2 个不同的 IIS 服务器上工作不同,其中一个被设置为网站,另一个被设置为 Web 应用程序。
我有 2 节课。
public class Config1{
public static string RelativePath {get; set;}
}
public class Config2{
public static readonly string FavIconPath = Config1.RelativePath;
}
我从 Global.asax.cs 中的 web.config 分配值
protected void Application_Start(){
Config1.RelativePath = getWebConfigValue("Path");
}
我在如下视图文件中使用它。
RelativePath : @Config1.RelativePath<p/>
FavIconPath : @Config2.FavIconPath
结果是
On web site server
RelativePath : somevalue
FavIconPath :
On web application server
RelativePath : somevalue
FavIconPath : somevalue
网站和网络应用程序的实例化时间有什么不同吗?任何帮助将不胜感激!
【问题讨论】:
标签: c# asp.net asp.net-mvc-3 iis-7