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

后端 未结 4 1841
鱼传尺愫
鱼传尺愫 2021-02-10 05:54

I want to publish a Webservice with custom binding configuration. I am using a custom binding configuration to increase the default message size of 65536 bytes. The problem I am

相关标签:
4条回答
  • 2021-02-10 06:22

    Add behavior for your Service and enable

    httpGetEnabled=true

    like this:

     <behavior name="MyService.Service1Behavior">
         <serviceMetadata httpGetEnabled="true" />
     </behavior>
    
    0 讨论(0)
  • 2021-02-10 06:38

    I have continued my research and followed this article which solved my problem:

    http://keithelder.net/2008/01/17/exposing-a-wcf-service-with-multiple-bindings-and-endpoints/

    Hope it can help others as well.

    0 讨论(0)
  • 2021-02-10 06:39

    Note that your problem is seems to be related with Metadata behaviour, before that you have to check name of service i.e.WebApplication1.MyService in below code; this should be in same order 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" />-->
    

    0 讨论(0)
  • 2021-02-10 06:39
    <serviceMetadata httpsGetEnabled="true" />
    

    You've enabled metadata service through https but you have a http endpoin for mexHttpsBinding. You have to use https for you endpoint address.


    Edit

    You use mexHttpsBinding so it's correct to use httpsGetEnabled. If you don't want https for metadata use httpGetEnabled and change 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 to use a full address notation per your mex endpoint

    <endpoint address="https://localhost:3440/MeterReadingOrderWS.svc/mex" contract="IMetadataExchange" binding="mexHttpsBinding" />
    
    0 讨论(0)
提交回复
热议问题