-1

The following is my web.config file:

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
  </system.web>
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" />
    <bindings>
      <webHttpBinding>
        <binding name="Binding" crossDomainScriptAccessEnabled="true">
          <security mode="Transport">
            <transport clientCredentialType="None" />
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <client />
    <services>
      <service name="Service1" behaviorConfiguration="ServiceBehaviour">
        <endpoint address="" binding="webHttpBinding" contract="Service1"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>   
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="ServiceBehaviourJSON">
          <webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json" />
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </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>
</configuration>

And I viewed a few examples of this error on here and changed what was asked but I still seem to get the same Metadata publishing for this service is currently disabled.??

My two files for the web service are called IService1.vb and Service1.svc.

Maybe someone can see the error that I can't and let me know :)

Updated web.config file

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
  </system.web>
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" />
    <bindings>
      <webHttpBinding>
        <binding name="Binding" crossDomainScriptAccessEnabled="true">
          <security mode="Transport">
            <transport clientCredentialType="None" />
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <client />
    <services>
      <service name="Service1" behaviorConfiguration="metadataBehavior">
        <endpoint address="" binding="webHttpBinding" contract="Service1"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        <endpoint address="" binding="basicHttpBinding" contract="Service1"
          />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:65234/Service1.svc"/>
          </baseAddresses>
        </host>
      </service>
    </services>   
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
        <behavior name="metadataBehavior">
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="ServiceBehaviourJSON">
          <webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json" />
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </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>
</configuration>
StealthRT
  • 10,108
  • 40
  • 183
  • 342

1 Answers1

0

You expose metadata using HTTP protocol (httpGetEnabled), then WCF seeks for address to expose but there is no HTTP base address defined, alas.

Maximus
  • 3,458
  • 3
  • 16
  • 27
  • http://weblogs.thinktecture.com/cweyer/2006/07/exposing-metadata-from-wcf-services.html – Maximus Dec 29 '15 at 20:16
  • Changing it still tells me its disabled. – StealthRT Dec 29 '15 at 20:23
  • You are trying to get REST or SOAP service metadata? – Maximus Dec 29 '15 at 20:52
  • Just REST. Not wanting SOAP. Is it on SOAP? – StealthRT Dec 29 '15 at 20:55
  • 1
    Rest does not expose metadata. http://stackoverflow.com/questions/5035118/exposing-meta-data-for-a-wcf-4-0-rest-template-service – Maximus Dec 29 '15 at 20:57
  • What would you recommend as a product to test the service out then since WCF Test Client doesn't work without that? – StealthRT Dec 29 '15 at 20:59
  • REST speaks for itself. You should be able to check it via browser or by using Fiddler where you can create more sofisticated requrests. If REST is correctly defined all you need to know is what type of data it exposes for instance employees and then send OPTION request so as to find out what kind of requests are allowed (GET/POST/HEAD/PUT). – Maximus Dec 29 '15 at 21:11