WCF Test Client : Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata

23,912

Solution 1

Found the solution Ok, after spending lot of time I cracked it. For some reason if I run the sample as console app it just works fine. But the moment I use WCFTestClient I was getting errors. If I remove the [ServiceKnownType(typeof(SyncIdFormatGroup))] from the contract it works in WCFTestClient. Hope that helps someone.

Solution 2

Have you enabled a mex (metadata exchange) endpoint in your service?

<endpoint 
      address="mex" 
      binding="mexHttpBinding" 
      contract="IMetadataExchange"/>
Share:
23,912
Vishal Patel
Author by

Vishal Patel

Updated on July 16, 2022

Comments

  • Vishal Patel
    Vishal Patel almost 2 years

    I am currently trying to get the sync framework sample working: sample

    The solution compiles with out any error or warning.

    But when I hit F5 the WCF Test Client launches and throws the following error.

    Local\Temp\Test Client Projects\10.0\5b6aab8a-6629-4a12-87c2-e9e75ba9c1e4\Client.cs(379,13) : error CS0246: The type or namespace name 'schema' could not be found (are you missing a using directive or an assembly reference?)

    Below is the code from Client.cs that the above error is referencing

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.0.30319.1")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.datacontract.org/2004/07/Microsoft.Synchronization")]
    public partial class SyncIdFormatGroup
    {
        private schema schemaField;
        private System.Xml.XmlElement anyField;
    
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Namespace="http://www.w3.org/2001/XMLSchema", Order=0)]
        public schema schema
        {
            get { return this.schemaField; }
            set { this.schemaField = value; }
        }
    
        /// <remarks/>
        [System.Xml.Serialization.XmlAnyElementAttribute(Order=1)]
        public System.Xml.XmlElement Any
        {
            get { return this.anyField; }
            set { this.anyField = value; }
        }
    }
    

    It would be great if some one could help me with the problem.