本文介绍了当前禁用了此服务的WCF元数据发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用WCF时,我很难显示元数据.

I am struggling to display metadata while using WCF.

我到处都看了.我不确定这是我的web.config文件中的设置,还是我的实际服务无法正常工作.但是我得到此服务的元数据发布当前被禁用".调试时显示页面.

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>

推荐答案

您的服务没有SOAP端点,因此没有要公开的有效元数据.如果您没有SOAP服务,则不需要serviceMetadata行为或MEX端点.

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?

这篇关于当前禁用了此服务的WCF元数据发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 23:33