Resolve WCF Error: Metadata publishing for this service is currently disabled

I want to publish a web service with a custom binding configuration. I am using a custom binding configuration to increase the default message size of 65,536 bytes. The problem I am facing is that when I use the web.config settings as shown below, I get an error message:

Metadata publishing for this service is currently disabled.

My main goal is to increase the default message size, so any other configuration is welcome, however I tried to simplify it as much as possible to avoid further problems.

Could you determine what is wrong with my configuration?

<bindings>
  <basicHttpBinding>        
      <binding name="NewBinding0" closeTimeout="00:10:00" openTimeout="01:10:00"
     receiveTimeout="01:10:00" sendTimeout="01:10:00" maxBufferSize="99536"
     maxBufferPoolSize="5242880" maxReceivedMessageSize="99536">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
          maxArrayLength="99536" maxBytesPerRead="99536" maxNameTableCharCount="2147483647" />
        <security>
          <transport clientCredentialType="Basic" />
        </security>

    </binding>
  </basicHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="MeterReadingOrderWSBehaviors">
      <serviceMetadata httpsGetEnabled="true" />         
    </behavior>
    </serviceBehaviors>

</behaviors>
<services>
  <service name="MeterReadingOrderWS.IMeterReadingOrderWS" behaviorConfiguration="MeterReadingOrderWSBehaviors">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:3440/MeterReadingOrderWS.svc"/> 
      </baseAddresses>
    </host>
    <endpoint address="" contract="MeterReadingOrderWS.IMeterReadingOrderWS" binding="basicHttpBinding" bindingConfiguration="NewBinding0" />
    <endpoint address="mex" contract="IMetadataExchange" binding="mexHttpsBinding" />
  </service>
</services>

+3
source
4

, , , , i.e.WebApplication1.MyService ; namespace.service

                                                  

    <endpoint  address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="MyServiceBebavior">
      <serviceMetadata  httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<!--<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />-->

+2

httpGetEnabled =

:

 <behavior name="MyService.Service1Behavior">
     <serviceMetadata httpGetEnabled="true" />
 </behavior>
+1
<serviceMetadata httpsGetEnabled="true" />

https, http endpoin mexHttpsBinding. https .


You are using mexHttpsBinding to use httpsGetEnabled correctly. If you do not want https for metadata to use httpGetEnabled and change the binding type for mex from mexHttpsBinding to mexHttpBinding.

    <endpoint address="mex" contract="IMetadataExchange" binding="mexHttpBinding" />
    <!--- ......- -->
    <serviceBehaviors>
       <behavior name="MeterReadingOrderWSBehaviors">
            <serviceMetadata httpGetEnabled="true" />         
       </behavior>
   </serviceBehaviors>

If you want to use https for metadata, consider using the full address notation for your mex endpoint

<endpoint address="https://localhost:3440/MeterReadingOrderWS.svc/mex" contract="IMetadataExchange" binding="mexHttpsBinding" />
0
source

All Articles