c# - 如何定位网络服务主机点
问题描述
这是我在 Stackoverflow 上的第一个问题。如果我犯了任何错误,请给我这个问题的减分,但请让我知道如何改进这个问题。在花了相当多的时间讨论上述问题后,我决定提出这个问题。我最近加入了一家开发 Windows 应用程序的公司。它有一个服务器 EXE 和一个客户端 EXE。服务器 EXE 与 Web 服务通信以获取最新更新和用户注册信息。它使用以下代码来测试 Web 服务的可用性。
private void testWebService()
{
if (WebServiceClient.IsValidHttpAddress(txtWebserviceURL.Text))
{
WebServiceClient svc = new WebServiceClient(new Uri(txtWebserviceURL.Text), txtWebserviceUserName.Text, txtWebservicePassword.Text);
string response;
if (svc.CheckWebResponse(new UserEndPoint(), out response))
{
//Mark the webservice url as read only again
txtWebserviceURL.ReadOnly = true;
}
MessageBox.Show(response, "Web Service Reponse", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
MessageBox.Show(string.Format("URL of '{0}' is invalid.{1}{1}It should start with 'http'.", txtWebserviceURL.Text, System.Environment.NewLine), "Web Service URL", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
当我让上面的方法被执行时,最终它调用了下面的方法并返回了一个异常——“远程服务器返回错误:(500)内部服务器错误。”
/// <summary>
/// Gets a web response from the web service on the required endpoint.
/// </summary>
/// <param name="pEndPoint">The endpoint to connect to the web service with.</param>
/// <returns>The response returned from the web request.</returns>
private HttpWebResponse GetWebResponse(WebServiceEndPointBase pEndPoint)
{
WebRequest fRequest = WebRequest.Create(pEndPoint == null ? this.Url : pEndPoint.GetEndPointUrl(this.Url));
fRequest.ContentType = "application/json";
fRequest.Headers.Add("Authorization", "Basic " + this.Credentials);
fRequest.Method = "GET";
fRequest.Timeout = this.Timeout;
HttpWebResponse fResponse = fRequest.GetResponse() as HttpWebResponse;
return fResponse != null && fResponse.StatusCode == HttpStatusCode.OK ? fResponse : null;
}
我相信网络服务由于某种原因停止了。由于我是公司的新手,并且没有记录与 Web 服务相关的信息,因此我无法确定 Web 服务的托管位置。Web 服务名称是“http://services.mycomanyname.com.au”。
到目前为止我做了什么。
我检查了属于我们公司的所有服务器(窗口)并检查了每个 IIS 服务器,我找不到任何托管服务。
我使用“挖掘”命令来查找更多信息。我能够找到服务的相关 IP 地址,但是当我尝试从 IP 地址检索主机名时,它没有返回任何名称。
我想要的是
- 请建议我找到托管 Web 服务的位置。目前,向现有员工询问不是我的选择。
- 请指导我获取500错误的原因。
解决方案
推荐阅读
- javascript - 执行该函数时停止该函数的所有实例-NodeJS
- jekyll - 使用 Jekyll-Paginate-v2 为分页添加省略号
- assembly - 制作程序集引导加载程序时出现问题,它将所有背景颜色写入视频内存
- java - JavaFX CheckBoxTableCell 拒绝绑定到值
- python-3.x - 从 Python DataFrame 创建一对
- bash - 在 bash 中创建一个文件夹
- rsa - 实施蒙哥马利模减/乘(MMM)
- android - progressBarStyle 在 Android Studio 上不起作用
- angular - 如何在 Angular 应用程序中包含外部静态文件
- c++ - Visual Studio 代码编译问题,c++