简体   繁体   中英

WCF Service not publishing the wsdl

I am pretty new to WCF Services but I never got my head around the bindings and all that. The service I have right now, works fine if tested in WCFTestClient but does not expose WSDL for other applications to use. I am not sure how it is done. Here is the code:

<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

<bindings>
  <basicHttpBinding>
    <binding name="DefaultBindingConfig">
      <!--<security mode="none">
        <transport clientCredentialType="none" />
      </security>-->

    </binding>
  </basicHttpBinding>
</bindings>

<services>
  <service name="Service.SecurityService">
    <endpoint address="" 
              name="SecurityServiceEndpoint" 
              binding="basicHttpBinding" 
              bindingConfiguration="DefaultBindingConfig" 
              contract="Service.Contracts.ISecurityService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

[ServiceContract]
  public interface ISecurityService
  {
    [OperationContract]
    ApplicationSecurity GetFunctionsAllowedForUser(string userName, string applicationName);    
}

How can I make it so that this service exposes the WSDL? I am pretty new to this.

The following line should expose the metadata for the wsdl:

<serviceMetadata httpGetEnabled="true"/>

In your browser, go to whatever the web address of the svc is and add ?wsdl to the end of it.

http://localhost:<Port>/<OptionalFolders/>MyService.svc?wsdl

If everything's working correctly, you should have a bunch of XML.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM