title: Service reference: Custom Tool warning: Cannot import wsdl:portType
body: <p>This is in relation to my <a href="https://stackoverflow.com/questions/8273662/saving-image-to-database-as-varbinary-silverlight/8273687#8273687">previous question</a>, which I think might be caused by this problem. </p>
  
  <p>I added a new service to add a varbinary to my database table: Afbeeldingen</p>
  
  <ul>
  <li>id:int</li>
  <li>afbeelding1:varbinary(max)</li>
  </ul>
  
  <p>I made the service contract like this: </p>
  
  <pre><code>[OperationContract]
  public void setAfbeelding(Afbeelding a)
  {
      dc.Afbeeldings.InsertOnSubmit(a);
      dc.SubmitChanges();
  }
  </code></pre>
  
  <p>I compiled the project, added the service reference to my main project and then I get the following errors:</p>
  
  <pre><code>Custom tool warning: Unable to load one or more of the requested
  types. Retrieve the LoaderExceptions property for more information.
  
  Custom tool warning: Cannot import wsdl:portType
  Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
  Error: Exception has been thrown by the target of an invocation.
  XPath to Error Source: //wsdl:definitions[@targetNamespace='']/wsdl:portType[@name='EditAfbeeldingService']
  
  ....
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/G9PiV.jpg" alt="service reference errors"></p>
  
  <p>I managed to fix this, by adjusting the reference like explained <a href="http://blogs.artinsoft.net/mrojas/archive/2010/11/25/custom-tool-warning-cannot-import-wsdl-porttype.aspx" rel="nofollow noreferrer">here</a>.
  But I don't think this is healthy and I think it is now causing me isseus with what I'm trying to do. ('OndernemersAward.EditAfbeeldingServiceReference.Binary' does not contain a constructor that takes 1 arguments, is the error I'm getting)</p>
  
  <p>I really hope somebody can help, silverlight and WCF have been one big mess for me so far..
  Thank you in advance,
  Thomas</p>