tags:

views:

347

answers:

1

I followed this link from another article on StackOverflow:

WCFExtras

This is my app.config from my WCF Service library.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <!-- 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. -->
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="TestClient.Service.Service1Behavior"
        name="TestClient.Service.SearchService">
        <endpoint address="" behaviorConfiguration="Sample.WsdlSampleEndpointBehavior" binding="basicHttpBinding" bindingConfiguration=""
          contract="TestClient.Service.ISearchService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/TestClient.Service/Service1/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="Sample.WsdlSampleEndpointBehavior">
          <wsdlExtensions location="http://localhost:8731/TestClient.Service/Service1/"/&gt;
        </behavior>

      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="TestClient.Service.Service1Behavior">
          <!-- To avoid disclosing metadata information, 
          set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="True"/>
          <!-- 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 -->
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <extensions>
      <behaviorExtensions>
 <!-- Declare that we have an extension called WSDL Extras-->
        <add name="wsdlExtensions" type="WCFExtras.Wsdl.WsdlExtensionsConfig, WCFExtras, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
      </behaviorExtensions>
    </extensions>
  </system.serviceModel>
</configuration>

I have stripped out parts like connection string section here. When I try to run with [XmlComments] it gives me an error as such:

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'.
<?xml version="1.0" encoding="utf-16"?>
  <Fault xmlns="http://www.w3.org/2003/05/soap-envelope"&gt;
    <Code><Value>Receiver</Value><Subcode><Value xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher"&gt;a:InternalServiceFault&lt;/Value&gt;&lt;/Subcode&gt;&lt;/Code&gt;
    <Reason><Text xml:lang="en-US">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;
    <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;
      <HelpLink i:nil="true"></HelpLink>
      <InnerException><HelpLink i:nil="true"></HelpLink><InnerException i:nil="true"></InnerException>
      <Message>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.</Message>
      <StackTrace>
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)</StackTrace><Type>System.ApplicationException</Type></InnerException><Message>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; outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace>
    <Type>System.InvalidOperationException</Type></ExceptionDetail></Detail></Fault>
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.
A: 

The meat of the error message is right there:

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.

Go to you project options, on the "Build" page, enable the creation of XML documentation.

David Schmitt