Debug web service consumed through URL
Posted By: jokertin92 Posted Date: April 16, 2012
Points:5 Category :ASP.Net
|
| I have created a new web service which I'm consuming using its URL from a testing application. Below is my testing app's code. I have set breakpoints in my Web Service and I want debug it when I come to the line "WebResponse res = req.GetResponse();" in my test app. But it doesn't go to my web method (DoHelp. I tried hosting the web service in IIS and attached the "aspnet_wp" process. Then it's working if I run from browser. Kindly give me some input to debug the web service from my test application.
string url = "http://localhost/MyService/Help.asmx?op=DoHelp"; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); //HttpRequest req = HttpContext.Current.Request; req.Headers.Add("Id", "354535018567138"); req.Headers.Add("format", "1"); req.Headers.Add("Name", "0"); req.ContentType = "audio/x-speex;rate=16000"; req.Method = "POST"; byte[] audioData = null; string path = Server.MapPath("."); path += "\\AudioFile\\audio_16k16bit.spx"; //string xx = Nuance.DoVoiceRecognition(); audioData = File.ReadAllBytes(path); Stream datastream = req.GetRequestStream(); datastream.Write(audioData, 0, audioData.Length); datastream.Close(); WebResponse res = req.GetResponse(); StreamReader sr = new StreamReader(res.GetResponseStream()); string outputResult = sr.ReadToEnd();
|
|
You must Sign In To post reply
|