Tom*_*gan 2 asp.net iis load-testing visual-studio-2013
我正在尝试在本地计算机上运行Visual Studio 2013 Web测试.这是我成功运行的测试(大约2个月前的最后一次).Web测试的第一步是对登录页面的GET请求.它看起来像这样:
获取https://example.com/Login.aspx
当我在网络浏览器中输入此网址时,它会成功.此外,我可以成功记录Web测试,我只是导航到此页面并登录.但是当我尝试重新运行我刚刚记录的webtest时,我得到了对GET请求的响应:
Request failed: An existing connection was forcibly closed by the remote host
Run Code Online (Sandbox Code Playgroud)
在example.com上IIS没有记录任何内容(IIS不记录GET请求).但是,当我手动登录或者记录Web测试时,IIS会正确记录GET请求.
在example.com或我的本地主机上的事件查看器中没有记录消息.
任何有关如何调试此问题的建议都非常感谢.
对我来说,问题是TLS握手.通过添加插件进行Web测试解决.
思考是原始问题,这对我有所帮助:https://social.msdn.microsoft.com/Forums/vstudio/en-US/bc3ebf23-575d-4e54-bd6b-a1ed87fe5213/web-performance-test-is-not-working启用-with-tls12-?论坛= vstest
插件来源:
using System;
using System.ComponentModel;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Microsoft.VisualStudio.TestTools.WebTesting;
[Description("This plugin will force the underlying System.Net ServicePointManager to negotiate downlevel SSLv3 instead of TLS. WARNING: The servers X509 Certificate will be ignored as part of this process, so verify that you are testing the correct system.")]
public class TLSPlugin : WebTestPlugin
{
[Description("Enable or Disable the plugin functionality")]
[DefaultValue(true)]
public bool Enabled { get; set; }
public override void PreWebTest(object sender, PreWebTestEventArgs e)
{
base.PreWebTest(sender, e);
//For TLS
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
//For SSL
//ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
//we wire up the callback so we can override behavior and force it to accept the cert
ServicePointManager.ServerCertificateValidationCallback = RemoteCertificateValidationCB;
//let them know we made changes to the service point manager
e.WebTest.AddCommentToResult(this.ToString() + " has made the following modification-> ServicePointManager.SecurityProtocol set to use SSLv3 in WebTest Plugin.");
}
public static bool RemoteCertificateValidationCB(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
//If it is really important, validate the certificate issuer here.
//this will accept any certificate
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2581 次 |
| 最近记录: |