title: Creating WCF ChannelFactory without an endpoint?
body: <p>I read that we're not supposed to use <code>using</code> around WCF Client. So I found <a href="https://stackoverflow.com/a/573925/1398193">this awesome answer</a> how to write elegant code around it.</p>
  
  <p>It's not perfect, cause it's not async and it doesn't return any value, so I created my version (based on other answers):</p>
  
  <pre><code>    public static async Task&lt;TReturn&gt; UseServiceAsync&lt;TChannel, TReturn&gt;(Func&lt;TChannel, Task&lt;TReturn&gt;&gt; code)
      {
          ChannelFactory&lt;TChannel&gt; _channelFactory = new ChannelFactory&lt;TChannel&gt;("NetTcpBinding_IMyService");
          TChannel channel = _channelFactory.CreateChannel();
          bool success = false;
          try
          {
              TReturn result = await code(channel);
              ((IClientChannel)channel).Close();
              success = true;
              return result;
          }
          finally
          {
              if (!success)
              {
                  ((IClientChannel)channel).Abort();
              }
          }
      }
  </code></pre>
  
  <p>It works great, but.. I don't want to specify my endpoint in the <code>ChannelFactory</code>. I provided contract interface already! It's totally enough to go to the config file and look for that endpoint. Why do I have to specify it explicitly?</p>
  
  <p>BTW. In the mentioned answer, there is a link to the article.. and they do something like this:</p>
  
  <p><code>public static ChannelFactory&lt;T&gt; _channelFactory = new ChannelFactory&lt;T&gt;("");</code></p>
  
  <p>How is that supposed to work?? I don't know.. </p>
  
  <p>My question to you guys is:
  <strong>How to create ChannelFactory without passing endpoint name explicitly?</strong></p>