title: wcf rest service consumption in c# console application
body: <p>I made wcf rest service by going New->projects->WCF Service Application
  I am unable to use methods in console application while i have hosted wcf rest service and referenced wcf rest service in application 
  My Application code is below :<br/>
  <b>IRestServiceImpL</b><br/></p>
  
  <pre><code>    [ServiceContract]
          public interface IRestServiceImpL
          {
          [OperationContract]
          [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Xml, 
          RequestFormat = WebMessageFormat.Xml, UriTemplate = "XmlData/{id}")]
          string XmlData(string id);
  
          [OperationContract]
          [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, 
          RequestFormat = WebMessageFormat.Json, UriTemplate = "JsonData/{id}")]
          string JsonData(string id);
          }
  </code></pre>
  
  <p><br/><br/></p>
  
  <p><b>RestServiceImpL.svc.cs </b><br/></p>
  
  <pre><code>[AspNetCompatibilityRequirements(RequirementsMode
  = AspNetCompatibilityRequirementsMode.Allowed)]
      public class RestServiceImpL : IRestServiceImpL
      {
         public string XmlData(string id)
         {
              return "you requested for " + id;
          }
  
          public string JsonData(string id)
          {
              return "you requested for " + id;
          }
  }
  </code></pre>
  
  <p><br/><br/></p>
  
  <p>Config File<br/>
      
      </p>
  
  <pre><code>    &lt;system.web&gt;
          &lt;compilation debug="true" targetFramework="4.0" /&gt;
      &lt;/system.web&gt;
      &lt;system.serviceModel&gt;
      &lt;bindings&gt;
          &lt;webHttpBinding&gt;
              &lt;binding name="StreamedRequestWebBinding"
                       bypassProxyOnLocal="true"
                       useDefaultWebProxy="false"
                       hostNameComparisonMode="WeakWildcard"
                       sendTimeout="10:15:00"
                       openTimeout="10:15:00"
                       receiveTimeout="10:15:00"
                       maxReceivedMessageSize="2147483647"
                       maxBufferSize="2147483647"
                       maxBufferPoolSize="2147483647"
                       transferMode="StreamedRequest"
                       crossDomainScriptAccessEnabled="true"
               &gt;
                  &lt;readerQuotas maxArrayLength="2147483647"
                                maxStringContentLength="2147483647" /&gt;
              &lt;/binding&gt;
          &lt;/webHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;services&gt;
          &lt;service name="RestService.RestServiceImpL" behaviorConfiguration="ServiceBehaviour"&gt;
              &lt;!--&lt;endpoint address="" binding="basicHttpBinding"  contract="RestService.IRestServiceImpL"&gt;&lt;/endpoint&gt;--&gt;
              &lt;endpoint address="" binding="webHttpBinding" name="StreamedRequestWebBinding" bindingConfiguration="StreamedRequestWebBinding"  contract="RestService.IRestServiceImpL" behaviorConfiguration="web"&gt;&lt;/endpoint&gt;
          &lt;/service&gt;
      &lt;/services&gt;
  
      &lt;behaviors&gt;
          &lt;serviceBehaviors&gt;
              &lt;behavior name="ServiceBehaviour"&gt;
                  &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt;
                  &lt;serviceMetadata httpGetEnabled="true"/&gt;
                  &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --&gt;
                  &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt;
              &lt;/behavior&gt;
          &lt;/serviceBehaviors&gt;
          &lt;endpointBehaviors&gt;
              &lt;behavior name="web"&gt;
                  &lt;webHttp/&gt;
              &lt;/behavior&gt;
          &lt;/endpointBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /&gt;
  &lt;/system.serviceModel&gt;
  &lt;system.webServer&gt;
      &lt;httpProtocol&gt;
          &lt;customHeaders&gt;
              &lt;add name="Access-Control-Allow-Origin" value="*"/&gt;
          &lt;/customHeaders&gt;
      &lt;/httpProtocol&gt;
      &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>
  <br/><br/>
  I host this service application in IIS <br/><br/></p>
  
  <p>Now after giving reference to console application when i call its methods 
  by using proxy class then i got error of Invalid Operation Contract Exception 
  that endpoint not specified
  <br/><br/>
  calling code is below :<br/><br/></p>
  
  <pre><code>ServiceClient oServiceClient = new ServiceClient();&lt;br/&gt;
  oServiceClient.JsonData("123");
  </code></pre>
  
  <p><br/></p>
  
  <p>Please suggest what is problem in the code.</p>