2
我有兩個非常簡單的Web服務方法,我稱之爲每秒鐘使用JSON 有在IIS內存泄漏,w3wp進程佔用300-400k第二 可以做什麼停止泄漏?服務器端內存泄漏
的方法如下:
[WebMethod]
[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
public List<StationStatus> GetAllStationsValues(string networkID ,string stationIDs)
{
List<StationStatus> stationStats = new List<StationStatus>();
foreach (string stationID in stationIDs.Split(','))
{
if (Application[networkID + "-" + stationID] != null)
{
string[] vals = (string[])Application[networkID + "-" + stationID];
stationStats.Add(new StationStatus() { NetworkID = networkID, StationID = stationID, ComponentName = vals[0].Split(':')[0], LatestValue = vals[0].Split(':')[1], Status = "0" });////////
}
}
return stationStats;
}
[WebMethod]
[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
public string GetValue(string networkID, string stationID)
{
int sec = DateTime.Now.Second;
if (Application[networkID + "-" + stationID] == null)
{
return "";
}
string[] compValues = (string[])Application[networkID + "-" + stationID];
string returnValue = "";
foreach (string compValue in compValues)
{
returnValue += compValue + ",";
}
return returnValue.TrimEnd(',');
}
什麼是應用程序類和StationStatus類?你可以爲他們添加代碼嗎? – Maarten