using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Text; using System.ServiceModel; using System.ServiceModel.Channels; using WcfService1; // Referenced the assembly directly instead of ServiceRefernce (Add References option) namespace ConsoleClient { class Program { static void Main(string[] args) { GenerateGetRequest(); } private static void GenerateGetRequest() { //Generate get request string url = "http://localhost/WcfServices/Service5.svc"; HttpWebRequest GETRequest = (HttpWebRequest)WebRequest.Create(url); GETRequest.Method = "GET"; Console.WriteLine("Sending GET Request"); HttpWebResponse GETResponse = (HttpWebResponse)GETRequest.GetResponse(); Stream GETResponseStream = GETResponse.GetResponseStream(); StreamReader sr = new StreamReader(GETResponseStream); Console.WriteLine("Response from Server"); Console.WriteLine(sr.ReadToEnd()); Console.ReadLine(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)