title: How to make large WCF services with many functions importable into VS 2010?
body: <p>I've got a large class with many functions exposed as a WCF service, which also has a mex endpiont. Now, when I'm trying to add a reference to that service in Visual Studio 2010, I'm getting following error:</p>
  
  <p><img src="https://i.stack.imgur.com/HSdvt.jpg" alt="mex error"></p>
  
  <p>Is there anything I can do, besides cutting back on the method count, to make this error disappear?</p>
  
  <p>Here's the code I'm using for the mex endpoint:</p>
  
  <pre><code>        // Check to see if the service host already has a ServiceMetadataBehavior
          ServiceMetadataBehavior smb = svh.Description.Behaviors.Find&lt;ServiceMetadataBehavior&gt;();
          // If not, add one
          if (smb == null)
              smb = new ServiceMetadataBehavior();
          //smb.HttpGetEnabled = true;
          smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
          svh.Description.Behaviors.Add(smb);
  
          // Add MEX endpoint
          svh.AddServiceEndpoint(
            ServiceMetadataBehavior.MexContractName,
            MetadataExchangeBindings.CreateMexTcpBinding(),
            location+"/mex"
          );
  </code></pre>