Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Duplexing Web Service Metadata publishing error RSS

2 replies

Last post Nov 17, 2008 09:50 PM by stbuchok

(0)
  • stbuchok

    stbuchok

    Member

    65 Points

    21 Posts

    Duplexing Web Service Metadata publishing error

    Nov 17, 2008 08:45 PM | LINK

    I am always getting an error about Metadata publishing for this service is currently disabled.

    I have followed the tutorial here step by step and can not figureout what is wrong: http://msdn.microsoft.com/en-us/library/cc645027(VS.95).aspx

  • anyeone

    anyeone

    Participant

    826 Points

    199 Posts

    Re: Duplexing Web Service Metadata publishing error

    Nov 17, 2008 09:34 PM | LINK

     Do you have a node in your web.config turning on the mex endpoint?

    <system.serviceModel>
            <behaviors>
                <serviceBehaviors>
                    <behavior name="MyBehavior">
                        <serviceMetadata httpGetEnabled="true"/>
                        <serviceDebug includeExceptionDetailInFaults="false"/>
                    </behavior>
                </serviceBehaviors>
            </behaviors>
            <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
            <services>
                <service behaviorConfiguration="MyBehavior" name="MySilverService">
                    <endpoint address="" binding="basicHttpBinding" contract="MySilverService"/>
                    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
                </service>
            </services>
        </system.serviceModel>

    --
    Anye Mercy
    AnyeDotNet.blogspot.com

    Please "Mark as Answer" the posts that help you - this lets others know the problem has been solved and helps others having the same problem know which solution works. Thanks!
  • stbuchok

    stbuchok

    Member

    65 Points

    21 Posts

    Re: Re: Duplexing Web Service Metadata publishing error

    Nov 17, 2008 09:50 PM | LINK

    Had to actually set it programmatially. I had tried that way 8 ways to Sunday with nothin'. So I tried setting it programmatically and voila!

     

    ServiceMetadataBehavior smb = this.Description.Behaviors.Find<ServiceMetadataBehavior>();

     

    if (smb == null)

    {

    smb =
    new ServiceMetadataBehavior();

    smb.HttpGetEnabled = true;

    smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;

    this.Description.Behaviors.Add(smb);

    this.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexHttpBinding(), "mex");

    }

     

     

    Thanks for your response though.