如何使用 Windows 身份验证对网页进行负载测试

发布于 2024-10-03 01:15:18 字数 227 浏览 0 评论 0原文

我正在为内部 Web 应用程序开发一些负载测试。

该问题似乎与我们使用 Windows 身份验证有关。如果我启动浏览器并导航到我们的应用程序,我就可以访问 Web 应用程序。但是,我无法在负载测试中通过网络请求访问应用程序。它抛出 401 异常,未经授权。

我正在使用 Visual Studio 2010 Ultimate。

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

I'm in the process of developing some load tests for an internal web application.

The problem appears to be related to our use of Windows authentication. I can access the web application if I launch the browser and nevigate to our app. I can't, however, access the application via webrequest in my load test. It throws a 401 exception, Unauthorized.

I'm using Visual Studio 2010 Ultimate.

How do I use my Windows credentials in my load test? Any other ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

墨洒年华 2024-10-10 01:15:18

选择测试主节点,然后单击红色标记按钮设置凭据

选择测试主节点,然后单击红色标记按钮设置凭据

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

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

盗梦空间 2024-10-10 01:15:18

如果您的负载测试工具无法指定要运行的凭据,则您将必须使用 Windows 模拟(仅用于执行测试)。

您可以在代码中执行此操作(请参见此处:http://www.codeproject.com/ KB/cs/cpimpersonation1.aspx),但如果您不需要花哨,使用要运行的凭据更新您的 web.config 会更容易:

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

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

If your load testing tool doesn't have a way to specify the credentials to run under, you will have to use Windows Impersonation (just to perform your tests).

You could potentially do this in code (see here: http://www.codeproject.com/KB/cs/cpimpersonation1.aspx), but if you don't need to get fancy, it will be easier to update your web.config with the credentials to run under:

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

This should work for any pages under the web site for which the web.config is configured.

深海夜未眠 2024-10-10 01:15:18

我发现这个作品...

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

I found this works...

 request.Credentials = System.Net.CredentialCache.DefaultCredentials;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文