[英]Why request.GetResponse() throwing “remote server returned an error: (500) ” on different port(!=80) urls?
I am getting exception(The remote server returned an error: (500) Internal Server Error.) for request.GetResponse() if I deploy application in different port other than 80(default), when I try to access the URL , it is working fine. 如果我尝试将应用程序部署到除80(默认)以外的其他端口时,我收到request.GetResponse()的异常(远程服务器返回错误:(500)内部服务器错误。),则当我尝试访问URL时,工作正常。
I had followed many suggestions from "Stackoverflow" and google. 我遵循了“ Stackoverflow”和google的许多建议。 still I am getting the error with the below code 仍然我得到以下代码的错误
private bool Ping(string url, out string message)
{
message = string.Empty;
try
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Credentials = CredentialCache.DefaultCredentials;
request.Timeout = 3000;
request.AllowAutoRedirect = false;
request.Method = "HEAD";
using (WebResponse response = request.GetResponse())
{
return true;
}
}
catch (Exception ex)
{
message = ex.Message;
}
return false;
}
Thanks, 谢谢,
Pavan 帕万
This is usually an issue on the server side and should have nothing to do with your application. 这通常是服务器端的问题,应该与您的应用程序无关。
That said, have you tried to access the same url
from your computer / device (via chrome or IE) with the other port? 也就是说,您是否尝试过使用其他端口从计算机/设备(通过Chrome或IE)访问相同的url
?
If it works on other devices, then you should check your device's setup; 如果它可以在其他设备上使用,则应检查设备的设置; but I still think it's an issue on the server. 但我仍然认为这是服务器上的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.