title: Create WCF client programmatically
body: <p>I have a website with a Silverlight-enabled WCF service. The service works fine, and I can browse to the WSDL page in the browser with no problems. </p>
  
  <p>Now, I am trying to create a client in a DLL. I need to create the whole client programmatically though, because it is being called in a DLL, which for whatever reason (by design?) won't read the ServiceModel section from its own config file. </p>
  
  <p>So here is my code: </p>
  
  <pre><code>Dim endp As EndpointAddress = New EndpointAddress("http://www.mydomain.com/licensing/lic.svc")
  Dim bind As WSHttpBinding = New WSHttpBinding()
  Dim svc = New lnt.licClient(bind, endp)
  Dim rsp = svc.CheckIt(key)
  </code></pre>
  
  <p>But when i call the svc.CheckIt method, i get the following error: </p>
  
  <pre><code>Content Type application/soap+xml; charset=utf-8 was not supported by service http://www.mydomain.com/licensing/lic.svc. 
  The client and service bindings may be mismatched.
  {"The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'application/soap+msbin1'.."}
  </code></pre>
  
  <p>How do I properly create my client so that these are properly "matched"??<br>
  Thanks in advance!!!</p>