STHISTools.ParamUrlCode.Url = url
STHISTools.ParamUrlCode.Url闲置时间较长就被回收了,为什么?
public class STHISTools
{
public class ParamUrlCode
{
private static string url = "";
public static string Url
{
get
{
return url;
}
set
{
url = value;
}
}
}
}
public class Servie : IService
{
private string Url = "";
//
/// 测试WCF链接是否建立成功
///
///
public bool TestLink(string url)
{
try
{
STHISTools.ParamUrlCode.Url = url;
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(STHISTools.ParamUrlCode.Url);
myRequest.Method = "POST"; //设置提交方式可以为"get","head"等
myRequest.Timeout = 10000; //设置网页响应时间长度
myRequest.AllowAutoRedirect = false;//是否允许自动重定向
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
}
}
}