WCF Metadata publishing for this service is currently disabled

限于喜欢 提交于 2020-01-25 12:28:15

问题


I am struggling to display metadata while using WCF.

I have looked all over the place. I'm not sure if it is a setting in my web.config file, or my actual service is not working properly. But I get the "Metadata publishing for this service is currently disabled." page when I debug.

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding name="myWebHttp"/>
      </webHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="EDSCoastmap">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="webHttp">
          <webHttp/>
        </behavior>
        <behavior name="jsonWebHttp">
          <enableWebScript/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="EDSCoastmap" name="EDS_CoastmapRest.EDSCoastmap">
        <endpoint behaviorConfiguration="webHttp" binding="webHttpBinding"
          bindingConfiguration="myWebHttp" contract="EDS_CoastmapRest.IEDSCoastmap" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
  </system.serviceModel>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
</configuration>

回答1:


Your service doesn't have SOAP endpoint so there are no valid metadata to be exposed. You don't need neither serviceMetadata behavior or MEX endpoint if you don't have SOAP service.

Btw. how do you debug the service?



来源:https://stackoverflow.com/questions/7403199/wcf-metadata-publishing-for-this-service-is-currently-disabled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!