從aspx頁面調用託管在服務器中的Web服務時,出現「請求失敗,返回空值」等錯誤。「調用Web服務時請求失敗,返回空」
代碼在我的網頁
try {
HttpWebRequest request1 = (HttpWebRequest)WebRequest.Create("https://login.erp.com/rodeprovisioning/provisioning.asmx");
request1.Accept = "text/xml";
request1.Method = "POST";
WebProxy proxyObject = new System.Net.WebProxy("http://10.0.0.1:8080/", true);
request1.Proxy.Credentials = CredentialCache.DefaultCredentials;
string sReturnValue = null;
if (string.IsNullOrEmpty(Session["Test"])) {
sReturnValue = callservice();
if (sReturnValue == "Success") {
ErrorLabel.Text = sReturnValue;
Session["Test"] = "True";
} else {
ErrorLabel.Text = sReturnValue;
}
}
} catch (Exception ex) {
}
,並在web.config中
<system.net>
<authenticationModules>
<add type = "System.Net.DigestClient" />
<add type = "System.Net.NegotiateClient" />
<add type = "System.Net.KerberosClient" />
<add type = "System.Net.NtlmClient" />
<add type = "System.Net.BasicClient" />
</authenticationModules>
<connectionManagement>
<add address = "*" maxconnection = "2" />
</connectionManagement>
<defaultProxy>
<proxy usesystemdefault="True" bypassonlocal = "True" />
</defaultProxy>
<webRequestModules>
<add prefix = "http" type = "System.Net.HttpRequestCreator" />
<add prefix = "https" type = "System.Net.HttpRequestCreator" />
<add prefix = "file" type = "System.Net.FileWebRequestCreator" />
</webRequestModules>
</system.net>
它是一個防火牆problem.Any建議?
您是否嘗試過使用Wireshark來了解HTTP級別發生了什麼? – 2011-12-27 08:18:23
沒有我沒有... – bala3569 2011-12-27 08:22:36
然後我建議,應該是你的下一步。嘗試調試客戶端是沒有意義的,如果它是服務器端問題,反之亦然。 – 2011-12-27 08:30:47