2010-11-16 114 views
1

我正在为内部Web应用程序开发一些负载测试。如何使用Windows身份验证加载测试网页

该问题似乎与我们使用Windows身份验证有关。我可以访问Web应用程序,如果我启动浏览器并nevigate到我们的应用程序。但是,我不能在我的负载测试中通过webrequest访问应用程序。它抛出了401例外,未经授权。

我正在使用Visual Studio 2010 Ultimate。

如何在我的负载测试中使用我的Windows凭据?任何其他想法?

回答

0

我发现这个工程...

request.Credentials = System.Net.CredentialCache.DefaultCredentials; 
0

如果您的负载测试工具没有指定要在其下运行的凭据的方式,则必须使用Windows模拟(仅用于执行测试)。

你可能做到这一点的代码(在这里看到:http://www.codeproject.com/KB/cs/cpimpersonation1.aspx),但如果你并不需要获得幻想,它会更容易更新的凭据你的web.config在其下运行:

<identity impersonate="true" userName="accountname" password="password" /> 

应该适用于web.config配置的网站下的任何页面。

1

Select The Test Main node, and click the red marked button to set credentials

选择测试的主节点,并单击红色标记的按键设置凭据