Asp.net IIS 7和.NET 3.5 SP1中的负载测试与线程
我正在使用.NET3.5SP1运行IIS7 有谁能告诉我这是否是线程安全的,因为它在高负载的用户下不断失败:Asp.net IIS 7和.NET 3.5 SP1中的负载测试与线程,asp.net,multithreading,.net-3.5,thread-safety,Asp.net,Multithreading,.net 3.5,Thread Safety,我正在使用.NET3.5SP1运行IIS7 有谁能告诉我这是否是线程安全的,因为它在高负载的用户下不断失败: private static void addQueryStringParameters(XElement inputs) { NameValueCollection qs = HttpContext.Current.Request.QueryString; XElement queryStringParameters = new XElement("QueryStri
private static void addQueryStringParameters(XElement inputs)
{
NameValueCollection qs = HttpContext.Current.Request.QueryString;
XElement queryStringParameters = new XElement("QueryStringParameters");
foreach (string key in qs.AllKeys)
{
try
{
if (!String.IsNullOrEmpty(key))
-- some code qs[Key]
}
catch (Exception exception)
{
-- some code
}
}
}
如果它是线程安全的,那么为什么它会失败
顺便说一下,我得到的异常是:未设置对象引用。您在哪一行得到异常?我们不知道,只是数据库中记录了一个异常。。使用此方法名..那么日志不是来自catch块中的代码?你不是从那里抛出错误吗?我是从那里抛出错误。。它从同一个catch块登录到数据库中..好的。那你为什么要问它是否线程安全?我假设这是一个网络应用。你在使用线程吗?