Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Cannot obtain Metadata from WCF service

Tags:

c#

wcf

I have a successfully running WCF service that I can call using javascript. However I want to invoke it using the WCF test client and im having difficulty doing this. I am told that I need to make sure I have enabled meta data publishing at the specified address. After reading the documentation I just cant see what im meant to do this is my configuration:

    <system.serviceModel>        <services>            <service name="CommentSessionIDWCFService"                      behaviorConfiguration="CommentSessionIDBehavior">               <endpoint                    address=""                    behaviorConfiguration="CountryProvinceBehavior"                   binding="webHttpBinding"                    contract="ICommentSessionIDWCFService" />            </service>        </services>        <behaviors>           <serviceBehaviors>              <behavior name="CommentSessionIDBehavior">                 <serviceMetadata httpGetEnabled="true"/>                 <serviceDebug includeExceptionDetailInFaults="true"/>              </behavior>           </serviceBehaviors>           <endpointBehaviors>               <behavior name="CountryProvinceBehavior">                   <webHttp/>               </behavior>           </endpointBehaviors>        </behaviors>     </system.serviceModel> 

I've read other posts but I can't see what to populate and I just keep getting errors. Q's..

  1. Am I right in saying that I need to configure a complete new service in my config to show the metadata?

  2. What do I add to the configuration to make this meta data published so I can invoke with the client?

like image 551
Exitos Avatar asked May 19 '11 09:05

Exitos


People also ask

Can not obtain metadata from WCF service?

Error: Cannot obtain Metadata from http://xxxxxxx/WcfService1/Service1.svc. 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.

How do I find the metadata of a WCF service?

You can retrieve service metadata using WS-MetadataExchange or HTTP/GET requests by using the ServiceModel Metadata Utility Tool (Svcutil.exe) tool and passing the /target:metadata switch and an address. Svcutil.exe downloads the metadata at the specified address and saves the file to disk.


1 Answers

You need a metadata endpoint for your service, here`s an example.

<services>     <service name="MyService" behaviorConfiguration="MEX">     <endpoint         address="http://localhost:8000/MEX"         binding="mexHttpBinding"         contract="IMetadataExchange"     />     </service> </services>  <behaviors>     <serviceBehaviors>         <behavior name="MEX">             <serviceMetadata/>         </behavior>     </serviceBehaviors> </behaviors> 
like image 98
Menahem Avatar answered Sep 19 '22 13:09

Menahem