如何调试"此服务的元数据发布目前已停用"?

时间:2015-08-11 08:08:28

标签: wcf

下面是我使用的web.config文件。

<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
 <services>
   <!--Note: the service name must match the configuration name for the service implementation.--> 
  <service name="_1C_GBCService.GBCService" behaviorConfiguration="GBCServiceBehavior">
    <endpoint address=""
          binding="wsHttpBinding"
          contract="_1C_GBCService.IGBCService" />
     <!--Add the following endpoint.  
     Note: your service must have an http base address to add this endpoint.-->
    <endpoint contract="IMetadataExchange" binding="mexHttpBinding"        address="mex" />
    </service>
    </services> 
    <behaviors>
    <serviceBehaviors>
    <behavior name="GBCServiceBehavior">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <!--policyVersion="Policy15"-->
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
    <!--<behavior name="ServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
    </behavior>-->
    </serviceBehaviors>
    </behaviors>
    <protocolMapping>
    <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
     <bindings>
     <basicHttpBinding>
    <binding name="VASASMXSoap" />
    </basicHttpBinding>
    <netTcpBinding>
    <binding name="NetTcpBinding_ILogging">
    <security mode="None" />
    </binding>
    </netTcpBinding>
    <wsHttpBinding>
    <binding name="WSHttpBinding_ILogging"  closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
      <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
      <security mode="None">
        <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
        <message clientCredentialType="Windows" negotiateServiceCredential="true"/>
        </security>
        </binding>
        </wsHttpBinding>
        </bindings>
        <client>
        <endpoint address="http://onecuatcoresrvs.cognizant.com/messaging/onecommunicator/notification/vas.asmx"
      binding="basicHttpBinding" bindingConfiguration="VASASMXSoap"
      contract="OneCommunicatorService.VASASMXSoap" name="VASASMXSoap">
       <identity>
          <dns value="localhost" />
       </identity>
       </endpoint>
       <endpoint address="http://onecsitcoresrvs.cognizant.com/255/Logging.svc"
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ILogging"
    contract="ExceptionLoggingService.ILogging" name="WSHttpBinding_ILogging">
       <identity>
      <dns value="localhost" />
      </identity>
       </endpoint>
       <endpoint address="net.tcp://onecsitcoresrvs.cognizant.com/255/Logging.svc"
    binding="netTcpBinding" bindingConfiguration="NetTcpBinding_ILogging"
    contract="ExceptionLoggingService.ILogging" name="NetTcpBinding_ILogging">
      <identity>
      <dns value="localhost" />
      </identity>
      </endpoint>
      </client>
      </system.serviceModel>
      <system.webServer>
      <modules runAllManagedModulesForAllRequests="true"/>
      <!--
    To browse web app root directory during debugging, set the value below to true.
    Set to false before deployment to avoid disclosing web app folder information.
  -->
      <directoryBrowse enabled="true"/>
       </system.webServer>

我很困惑是否在绑定元素中添加name以外的属性。

1 个答案:

答案 0 :(得分:0)

启用为您的服务 GBCService 发布元数据。我添加了bindingConfiguration等于WSHttpBinding_ILogging。

<service name="_1C_GBCService.GBCService" behaviorConfiguration="GBCServiceBehavior">
     <endpoint address="" bindingConfiguration="WSHttpBinding_ILogging"
               binding="wsHttpBinding"
               contract="_1C_GBCService.IGBCService" />
     <!--Add the following endpoint.Note: your service must have
         an http base address to add this endpoint.-->
    <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>

并将您的协议映射更改为wsHttpBinding并将方案更改为HTTP,因为这是您正在使用的绑定。和HTTP因为您的元数据交换或mex使用了非安全的mexHttpBinding。

<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />

<protocolMapping>
   <add binding="wsHttpBinding" scheme="http" />
</protocolMapping>
相关问题