C# MVC 4 WEB API服务层无法从c代码调用url

C# MVC 4 WEB API服务层无法从c代码调用url,c#,asp.net-mvc-4,iis-7.5,httpresponse,asp.net-web-api,C#,Asp.net Mvc 4,Iis 7.5,Httpresponse,Asp.net Web Api,我有一个MVC4WebAPI服务层。 我正试图用以下代码从我的web应用程序调用服务层 HttpResponseMessage responsemsg = new HttpResponseMessage(); HttpClient client = new HttpClient(); ServiceUrl = "http://localhost:51093"; client.BaseAddress = new Uri(ServiceUrl); client.Default

我有一个MVC4WebAPI服务层。 我正试图用以下代码从我的web应用程序调用服务层

HttpResponseMessage responsemsg = new HttpResponseMessage();
HttpClient client = new HttpClient();
            ServiceUrl = "http://localhost:51093";
client.BaseAddress = new Uri(ServiceUrl);
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
ListParams LP = new ListParams();
LP.Add("param1", dtDate.SelectedDate);
LP.Add("Param2", AR.GetMaxAccountRefID().ToNonNullString());
foreach (KeyValuePair<string, object> item in LP)
            {
                param = param + item.Key + "=" + item.Value + "&";
            }
            try
            {
                responsemsg = client.GetAsync("/api/ProductAccount?" + param, HttpCompletionOption.ResponseContentRead).Result;
            }
if (responsemsg.IsSuccessStatusCode)
{
          // code
}
然后,它没有调用并得到404错误


请告诉我遗漏了什么。

您是否100%确定192.168.0.139的web服务器已在8080上部署并运行WebAPI代码?是的,当然。我可以使用此url直接从浏览器运行服务“”新服务url的末尾有一个尾随斜杠,在追加路径的开头也有一个前斜杠。
ServiceUrl ="http://192.168.0.139:8080/"; //(Service Hosted path)