2010-11-16 37 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

選擇測試的主節點,並單擊紅色標記的按鍵設置憑據

相關問題