我在asp.net中編寫代碼以從外部web服務器獲取XML數據。從遠程服務器請求XML數據時出現ASP.NET網站問題
*的.cs代碼
連接字符串:外部(第三方)的URL服務器進行XML數據
WebRequest req = WebRequest.Create(connectionString);
req.Proxy = WebProxy.GetDefaultProxy();
req.Proxy.Credentials = CredentialCache.DefaultCredentials;
req.Timeout = 1000;
using (WebResponse resp = req.GetResponse())
{
// reading data from XML file
}
要點 1. GetDefaultProxy()返回關於代理 信息2.默認憑證()返回用戶名密碼,我已經寫在web.config中,如下所示
的Web.config
<identity impersonate="true"
username="Username of PC where website is running"
password="password"/>
問題陳述: 安裝網站安裝後:上面的代碼工作正常,在WindowsXP中,但相同的代碼不會在Windows Server 2003中工作,我無法找出什麼額外我們需要在Windows Server 2003中配置。
請幫我找出解決方案?
[編輯]
非常隨機beheviour在服務器觀察到。有時,當我們登錄到Windows Server 2003時,數據出現並出現在客戶端(瀏覽器)。 但是,當我們從服務器註銷並嘗試從另一臺PC上的客戶端(瀏覽器)請求數據時。它出現的時間很短。在等待1小時後,數據不會用於新請求。
你可能在serverfault.com有更好的運氣。 – RedFilter 2009-09-29 12:55:22