为什么HttpResponse总是返回404状态代码

时间:2014-08-11 18:00:49

标签: c# windows-phone-8

我正在尝试向http://localhost/apptfg/get_biography_group?nombre_grupo=fondoflamenco发送请求,这是一个基于php的Web服务,访问mysql数据库并检索有关该组的信息但是当我在Windows Phone 8中执行应用程序时,我总是找不到404设备,但是当我在fiddler中调试url时,我得到的结果必须是{"success":1,"group":[{"nombre_grupo":"fondoflamenco","anyo_creacion":"2006","descripcion":"Fondo Flamenco Flamenco is a group formed by three young Sevillian. Astola Alejandro Soto, Antonio Sanchez and Rafael Ruda M.R","musicos":"Rafael Ruda,Antonio Manuel Rios,"}]} 这是我在我的应用程序中使用的HttpClient代码:

       public async Task<string> makeHttpRequest(string group_name)
    {
        var resultstring = String.Empty;
        HttpClient client = new HttpClient();
        client.DefaultRequestHeaders.Add("Accept", "text/html");

        try
        {
            resultstring = await client.GetStringAsync(new Uri("http://localhost/apptfg/get_group_biography.php?nombre_grupo=" + group_name));
            client.Dispose();

        }
        catch (Exception exp)
        {
            Console.WriteLine(exp.Message);
        }
        return resultstring;
    }

0 个答案:

没有答案