Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# vs2012负载测试:分配1000个用户负载,但测试只运行100次_C#_Asp.net_Web Services_Visual Studio 2012 - Fatal编程技术网

C# vs2012负载测试:分配1000个用户负载,但测试只运行100次

C# vs2012负载测试:分配1000个用户负载,但测试只运行100次,c#,asp.net,web-services,visual-studio-2012,C#,Asp.net,Web Services,Visual Studio 2012,我已经编写了一个调用webservice的webtest: public class Settings_CacheExplosion : WebTest { //private static readonly ILog activityLog = LogManager.GetLogger("Activity"); private static int _ctidsCounter { get; set; } public static int CtidsCounte

我已经编写了一个调用webservice的webtest:

 public class Settings_CacheExplosion : WebTest
{
    //private static readonly ILog activityLog = LogManager.GetLogger("Activity"); 

    private static int _ctidsCounter { get; set; }

    public static int CtidsCounter
    {
        get
        {
            if (_ctidsCounter == 2000)
            {
                _ctidsCounter = 1000;
            }
            return _ctidsCounter++;
        }
        set
        {
            _ctidsCounter = value;
        }
    }

    public Settings_CacheExplosion()
    {
        this.PreAuthenticate = true;

        CtidsCounter = 1000;

        //log4net.Config.XmlConfigurator.Configure();
    }


    public override IEnumerator<WebTestRequest> GetRequestEnumerator()
    {
        WebTestRequest request1 = new WebTestRequest("http://clientservice.mam.qasite-services.com/settings");

        request1.Method = "POST";

        Debug.WriteLine(string.Format("ctid={0}", CtidsCounter));

        request1.QueryStringParameters.Add("ctid", CtidsCounter.ToString(), false, false);
        StringHttpBody request1Body = new StringHttpBody();
        request1Body.ContentType = "";
        request1Body.InsertByteOrderMark = false;
        request1Body.BodyString = "";
        request1.Body = request1Body;

        yield return request1;
        request1 = null;
    }
}
公共类设置\u缓存爆炸:WebTest
{
//私有静态只读ILog activityLog=LogManager.GetLogger(“活动”);
私有静态int_ctidsCounter{get;set;}
公共静态计数器
{
得到
{
如果(_ctidsCounter==2000)
{
_ctidsCounter=1000;
}
返回_ctidsCounter++;
}
设置
{
_ctidsCounter=数值;
}
}
公共设置\u缓存爆炸()
{
this.PreAuthenticate=true;
CtidsCounter=1000;
//log4net.Config.XmlConfigurator.Configure();
}
公共重写IEnumerator GetRequestEnumerator()
{
WebTestRequest1=新的WebTestRequest(“http://clientservice.mam.qasite-services.com/settings");
request1.Method=“POST”;
WriteLine(string.Format(“ctid={0}”,CtidsCounter));
request1.QueryStringParameters.Add(“ctid”,CtidsCounter.ToString(),false,false);
StringHttpBody request1Body=新的StringHttpBody();
request1Body.ContentType=“”;
request1Body.InsertByteOrderMark=false;
request1Body.BodyString=“”;
request1.Body=request1Body;
收益返回请求1;
request1=null;
}
}
我hvae创建了一个负载测试,测试组合为:100%以上的webtest

在负载测试向导中,我分配了
1000个用户(常量)

我根据虚拟用户的数量将测试设置为运行

然而,负载测试在2秒后结束

我看到上面的测试只执行了100次

是什么引起的

顺便说一句,我试图查看
请求表
,但它只包含一行


如何查看所有请求?

与您的问题有点无关,但您为什么将
\u ctidsCounter
设置为属性而不仅仅是字段?还有,当它达到2000时,将其重置为1000的原因是什么?我认为
私有静态int\u ctidsCounter
公共静态int-ctidsCounter{get{return{return\u ctidsCounter++}}
就足够了。对于第二个问题,它与我想从数据库中获取的ID范围有关。对于第一个问题,使用属性总是一个很好的实践。请参阅:我知道,但对我来说,用另一个属性公开一个属性似乎有些过分,仅此而已:)不确定什么是
GetRequestEnumerator
。我怎么去呢?