title: Configuring and using WCFExtras - WCF/C#/VS2008
body: <p>I followed this link from another article on StackOverflow:</p>
  
  <p><a href="http://wcfextras.codeplex.com/Wiki/View.aspx?title=HowToUse" rel="nofollow noreferrer">WCFExtras</a></p>
  
  <p>This is my app.config from my WCF Service library.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;system.web&gt;
      &lt;compilation debug="true" /&gt;
    &lt;/system.web&gt;
    &lt;!-- When deploying the service library project, the content of the config file must be added to the host's 
    app.config file. System.Configuration does not support config files for libraries. --&gt;
    &lt;system.serviceModel&gt;
      &lt;services&gt;
        &lt;service behaviorConfiguration="TestClient.Service.Service1Behavior"
          name="TestClient.Service.SearchService"&gt;
          &lt;endpoint address="" behaviorConfiguration="Sample.WsdlSampleEndpointBehavior" binding="basicHttpBinding" bindingConfiguration=""
            contract="TestClient.Service.ISearchService"&gt;
            &lt;identity&gt;
              &lt;dns value="localhost" /&gt;
            &lt;/identity&gt;
          &lt;/endpoint&gt;
          &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt;
          &lt;host&gt;
            &lt;baseAddresses&gt;
              &lt;add baseAddress="http://localhost:8731/TestClient.Service/Service1/" /&gt;
            &lt;/baseAddresses&gt;
          &lt;/host&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;endpointBehaviors&gt;
          &lt;behavior name="Sample.WsdlSampleEndpointBehavior"&gt;
            &lt;wsdlExtensions location="http://localhost:8731/TestClient.Service/Service1/"/&gt;
          &lt;/behavior&gt;
  
        &lt;/endpointBehaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior name="TestClient.Service.Service1Behavior"&gt;
            &lt;!-- To avoid disclosing metadata information, 
            set the value below to false and remove the metadata endpoint above before deployment --&gt;
            &lt;serviceMetadata httpGetEnabled="True"/&gt;
            &lt;!-- To receive exception details in faults for debugging purposes, 
            set the value below to true.  Set to false before deployment 
            to avoid disclosing exception information --&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="False" /&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;extensions&gt;
        &lt;behaviorExtensions&gt;
   &lt;!-- Declare that we have an extension called WSDL Extras--&gt;
          &lt;add name="wsdlExtensions" type="WCFExtras.Wsdl.WsdlExtensionsConfig, WCFExtras, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/&gt;
        &lt;/behaviorExtensions&gt;
      &lt;/extensions&gt;
    &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I have stripped out parts like connection string section here. When I try to run with <strong>[XmlComments]</strong> it gives me an error as such:</p>
  
  <pre><code>Error: Cannot obtain Metadata from http://localhost:8731/TestClient.Service/Service1/mex
  If this is a Windows (R) Communication Foundation service to which you have access,
  please check that you have enabled metadata publishing at the specified address.
  For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error
  URI: http://localhost:8731/TestClient.Service/Service1/mex
  Metadata contains a reference that cannot be resolved: 'http://localhost:8731/TestClient.Service/Service1/mex'.
  &lt;?xml version="1.0" encoding="utf-16"?&gt;
    &lt;Fault xmlns="http://www.w3.org/2003/05/soap-envelope"&gt;
      &lt;Code&gt;&lt;Value&gt;Receiver&lt;/Value&gt;&lt;Subcode&gt;&lt;Value xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher"&gt;a:InternalServiceFault&lt;/Value&gt;&lt;/Subcode&gt;&lt;/Code&gt;
      &lt;Reason&gt;&lt;Text xml:lang="en-US"&gt;An exception was thrown in a call to a WSDL export extension: WCFExtras.Wsdl.Documentation.XmlCommentsAttribute contract: http://tempuri.org/:ISearchService&lt;/Text&gt;&lt;/Reason&gt;
      &lt;Detail xmlns:s="http://www.w3.org/2003/05/soap-envelope"&gt;&lt;ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt;
        &lt;HelpLink i:nil="true"&gt;&lt;/HelpLink&gt;
        &lt;InnerException&gt;&lt;HelpLink i:nil="true"&gt;&lt;/HelpLink&gt;&lt;InnerException i:nil="true"&gt;&lt;/InnerException&gt;
        &lt;Message&gt;XML documentation file for TestClient.Service.dll was not found. Make sure the XML documentation option is enabled in the project properties for that assembly.&lt;/Message&gt;
        &lt;StackTrace&gt;
  at WCFExtras.Utils.XmlCommentsUtils.LoadXmlComments(Type type, Boolean throwIfNotFound) in C:\sandbox\WCFExtras\WCFExtras\Utils\XmlCommentsUtils.cs:line 305
  at WCFExtras.Wsdl.Documentation.XmlCommentsExporter.ExportContract(WsdlExporter exporter, WsdlContractConversionContext context, XmlCommentFormat format) in C:\sandbox\WCFExtras\WCFExtras\Wsdl\Documentation\XmlCommentsExporter.cs:line 172
  at WCFExtras.Wsdl.Documentation.XmlCommentsAttribute.ExportContract(WsdlExporter exporter, WsdlContractConversionContext context) in C:\sandbox\WCFExtras\WCFExtras\Wsdl\Documentation\XmlCommentsAttribute.cs:line 45
  at System.ServiceModel.Description.WsdlExporter.CallExtension(WsdlContractConversionContext contractContext, IWsdlExportExtension extension)&lt;/StackTrace&gt;&lt;Type&gt;System.ApplicationException&lt;/Type&gt;&lt;/InnerException&gt;&lt;Message&gt;An exception was thrown in a call to a WSDL export extension: WCFExtras.Wsdl.Documentation.XmlCommentsAttribute contract: http://tempuri.org/:ISearchService&lt;/Message&gt;&lt;StackTrace&gt;
  at System.ServiceModel.Description.ServiceMetadataBehavior.MetadataExtensionInitializer.GenerateMetadata()   at System.ServiceModel.Description.ServiceMetadataExtension.EnsureInitialized()
  at System.ServiceModel.Description.ServiceMetadataExtension.WSMexImpl.GatherMetadata(String dialect, String identifier)
  at System.ServiceModel.Description.ServiceMetadataExtension.WSMexImpl.Get(Message request)   at SyncInvokeGet(Object , Object[] , Object[] )
  at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp;amp; outputs)
  at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp;amp; rpc)
  at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp;amp; rpc)
  at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp;amp; rpc)
  at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&amp;amp; rpc)
  at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&amp;amp; rpc)
  at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&amp;amp; rpc)
  at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)&lt;/StackTrace&gt;
      &lt;Type&gt;System.InvalidOperationException&lt;/Type&gt;&lt;/ExceptionDetail&gt;&lt;/Detail&gt;&lt;/Fault&gt;
  HTTP GET Error
  URI: http://localhost:8731/TestClient.Service/Service1/mex
  There was an error downloading 'http://localhost:8731/TestClient.Service/Service1/mex'.
  The request failed with HTTP status 400: Bad Request.
  </code></pre>