在asp.net应用程序中加入了webservice,其中的global.asax是否共用的吗?我在
void Application_Start(object sender, EventArgs e)
{
// 在应用程序启动时运行的代码
BLLServer bllServer = new BLLServer();
Application[ "BllServer "] = bllServer;
}
加入的代码,在调试的时候能很好的运行,但放在IIS中好象不运行了,为什么?在其它在地方Application[ "BllServer "]是null,请高手指教...
开发工具vs2005
------解决方案--------------------
经调试没有问题。。。。。
Global:
void Application_Start(object sender, EventArgs e)
{
Application[ "MyTest "] = DateTime.Now.ToString();
}
WebService:
[WebMethod]
public string HelloWorld() {
if (Application[ "MyTest "] != null)
{
return Application[ "MyTest "].ToString();
}
else
{
return "application null ";
}
}
ASPX:
if(Application[ "MyTest "]!=null)
Response.Write(Application[ "MyTest "].ToString());
Response.Write( " <hr> ");
localhost.WebService ser = new localhost.WebService();
string s = ser.HelloWorld();
Response.Write(s);