Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I have used this site a lot and you guys have saved my job couple of times. Thanks a lot, for the start.
I am not sure if this section to post this question. Its my first post here.
I have a simple ASP.NET Web Service (C# VS 2008) that reads a table from MS SQL Server 2005 and returns a string contain the XML rep of that table (acquired using WriteXML). When I run this Web Service is displays the string successfully in Explorer. But I am trying to call it from a Windows Phone App using httpwebresponce it raise the exception {"The remote server returned an error: NotFound."}
It does nothing (not working) when I call it using WebClient. Here is what my call from WP7 looks like:

...

 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri("http://localhost:3808/GatherService.asmx/TestMTD"));

 request.BeginGetResponse(new AsyncCallback(ReadCallback), request);
            return XMLtxt;
 }

        private void ReadCallback(IAsyncResult asynchronousResult)
        {
            HttpWebRequest request =
           (HttpWebRequest)asynchronousResult.AsyncState;
            HttpWebResponse response =
           (HttpWebResponse)request.EndGetResponse(asynchronousResult);
            using (StreamReader streamReader1 =
           new StreamReader(response.GetResponseStream()))
            {
                string resultString = streamReader1.ReadToEnd();
                XMLtxt = HttpUtility.HtmlEncode(resultString);
            }
        }
Posted

1 solution

I am suspecting with your service deployment. Is your service deployed on port no 3808? Make sure your service is running when client is calling your service.
 
Share this answer
 
Comments
darkhorse_code 5-Apr-11 3:11am    
@Parwej Ahamad: I am quite sure the port number is correct. I am using ASP.NET Development Server and each time I run my WP7 app I check to make sure it is still run at "ASP.NET Development Server - Port 3808".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900