title: calling asmx from c# server side: endpoint element matching this contract could be found in the client element
body: <p>I wrote an asmx webSerivce on srv1.
  I wrote a <strong>bll project of an asp.net</strong> (original text: an asp.net) project on srv2.
  Both are hosted under the same web domain </p>
  
  <p>I want to call the asmx from the  <strong>bll project of the asp.net</strong> (original text: asp.net(c#) code behind).</p>
  
  <p>1) I added a web reference, but couldn't find any tutorial how to really call the referenced service.</p>
  
  <p>I have tried:</p>
  
  <pre><code>private void GetTemplateComponentsData()
  {
      var service = new ServiceReference.GetTemplateParamSoapClient();
      TemplateParamsKeyValue[] responsArray = service.GetTemplatesParamsPerId(id);
  
      foreach (var pair in responsArray)
      {
          TemplateComponentsData.Add(pair.Key, pair.Value);
      }
  }
  </code></pre>
  
  <p>but get the following error when executing the first line:
  <strong>Could not find default endpoint element that references contract 'ServiceReference.GetTemplateParamSoap' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.</strong></p>
  
  <p>What am I missing?</p>
  
  <p>2) I plane to migrate the asp.net proj and asmx together from one domain to another. 
  Is there any way to reference this webservice relatively ?</p>