C# 调用PHP Web服务时发生TargetInvestment异常

C# 调用PHP Web服务时发生TargetInvestment异常,c#,php,web-services,windows-8,windows-phone-8,C#,Php,Web Services,Windows 8,Windows Phone 8,我正在创建Windows Phone 8应用程序。我需要调用返回JSON的PHP web服务。当我打电话给该服务时,我得到了一个异常。详细信息和代码如下所示。我尝试使用HttpClient在Windows8应用程序中调用相同的web服务,它工作正常 private void btnLogin_Click(object sender, RoutedEventArgs e) { if (IsValidData()) { var webClient = new WebC

我正在创建Windows Phone 8应用程序。我需要调用返回JSON的PHP web服务。当我打电话给该服务时,我得到了一个异常。详细信息和代码如下所示。我尝试使用HttpClient在Windows8应用程序中调用相同的web服务,它工作正常

private void btnLogin_Click(object sender, RoutedEventArgs e)
{
    if (IsValidData())
    {
        var webClient = new WebClient();
        webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webClient_DownloadStringCompleted);
        webClient.DownloadStringAsync(new Uri(string.Format(LOGIN_URL, txtUsername.Text, txtPassword.Password))); 
    }
}

void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
    var aa = e.Result; //Exception is here
}

An exception of type 'System.Reflection.TargetInvocationException' occurred in System.ni.dll but was not handled in user code

Inner Exception Details:

System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
   at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
   at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClasse.<EndGetResponse>b__d(Object sendState)
   at System.Net.Browser.AsyncHelper.<>c__DisplayClass1.<BeginOnUI>b__0(Object sendState)
   --- End of inner exception stack trace ---
   at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
   at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
   at System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result)

这个错误非常明确:远程服务器返回了一个错误:NotFound。查看手机无法到达此地址的原因和/或服务器返回错误代码的原因