在Visual Studio 2013 Ultimate中的Web性能测试中获得407代理身份验证所需的错误 [英] getting 407 proxy authentication required error in web performance test in visual studio 2013 ultimate
问题描述
我为我的应用程序记录了一个Web性能测试,并且在播放过程中,对于记录的所有http请求,我都收到407代理身份验证所需的错误.当我在网络测试的属性中提供代理地址,用户名和密码时,我被禁止使用403 和405请求方法不允许错误.我也尝试通过与此相同的网络测试插件提供代理地址.我们通常使用代理服务器访问Internet,并且该地址是在我的Internet选项中设置的.我可以在中访问该应用程序 即但我想知道为什么这会在Visual Studio中引发407错误.您能告诉我解决方案吗?
I recorded a web performance test for my application and during play back i am getting 407 proxy authentication required error for all the http requests recorded. When i provide proxy address, userid, password in properties of web test i am getting 403 forbidden and 405 request method not allowed errors. I tried giving proxy address through web test plugin same with this as well. We usually use proxy server to access to internet and that address is set in my internet options. I am able to access the application in ie but i am wondering why this is throwing 407 error in visual studio. Could you please tell me a solution for this......
推荐答案
您好akepati,
>>我也尝试通过与此相同的网络测试插件提供代理地址
请提供详细代码.
示例代码:
public class MyWebTestPlugin : WebTestPlugin
9 {
10
11
12 public override void PreWebTest(object sender, PreWebTestEventArgs e)
13 {
14 // Create a WebProxy object for your proxy
15 WebProxy webProxy = new WebProxy("<http://yourproxy>");
16
17 //Set the WebProxy so that even local addresses use the proxy
18 // webProxy.BypassProxyOnLocal = false;
19
20 // Use this WebProxy for the Web test
21 e.WebTest.WebProxy = webProxy;
22
23
24
25 e.WebTest.PreAuthenticate = true;
26 NetworkCredential proxyCredentials;
27
28 proxyCredentials = new NetworkCredential();
29
30 proxyCredentials.Domain = "yourDomain";
31 proxyCredentials.UserName = "yourUserName";
32 proxyCredentials.Password = "yourPassword";
33 e.WebTest.WebProxy.Credentials = proxyCredentials;
34
35
36
37
38 }
39 }
注意
Starain
这篇关于在Visual Studio 2013 Ultimate中的Web性能测试中获得407代理身份验证所需的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!