Search This Blog

June 15, 2008

Need to install VSTS 2008 SP1 if your web test and proxy setting fails in VSTS 2008

I posted the issue in the following forum.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3486137&SiteID=1

I try to create a web test using proxy, and the following codes are working in VSTS 2005, but it is not working in VSTS 2008. I got the following error:

Request failed: No connection could be made because the target machine actively refused it IP Address:80

During 1 day search and I find one clean machine to repro, I find the problem .

VSTS 2008 RTM has the bug related to webtest and proxy. That's why it failed in VSTS 2008 RTM , but passed in VSTS 2005.

Because VSTS 2008 SP1 Beta is still in beta version, usually people don't install it. If they don't install it, it means this web test and proxy will not work forever.

After I installed it and ran the test again, the web test passed.

using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using Microsoft.VisualStudio.TestTools.WebTesting;

public class WebTest3Coded : WebTest
{
public WebTest3Coded()
{
this.PreAuthenticate = false;
NetworkCredential credential;
credential = (NetworkCredential)CredentialCache.DefaultCredentials;
WebProxy proxy = new WebProxy("198.152.203.10", 80);
proxy.Credentials = credential;
this.WebProxy = proxy;
}
public override IEnumerator GetRequestEnumerator()
{
WebTestRequest request1 = new WebTestRequest("http://www.microsoft.com/");
yield return request1;
}
}

No comments: