MVC 4 Web API サービス層があります。このコードを使用して、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
}
これは正常に動作しています..そして、私が変更している場合
ServiceUrl ="http://192.168.0.139:8080/"; //(Service Hosted path)
次に、呼び出しが行われず、404 エラーが発生します。
何か足りないところを教えてください..