Question

I'm new to WCF and I've been hitting my head for the past week trying to get everything to work. When browsing the service.svc file I receive the message about the metadata not being enabled. There's hundreds of posts on this but I must be missing something. I think I followed the instructions correctly but I still can't find my error. Where am I going wrong? Any help is appreciated.

service.svc

<%@ ServiceHost Service="BiteSizeLearningWS.TranscriptService" Debug="true" %>

web.config

<services>
  <service name="BiteSizeLearningWS.iServiceInterface" behaviorConfiguration="TranscriptServiceBehavior">

    <endpoint address="" binding="basicHttpBinding" contract="BiteSizeLearningWS.TranscriptService" />

    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>

  </service>
</services>

<behaviors>
  <serviceBehaviors>
    <behavior name="TranscriptServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

ServiceContract

namespace BiteSizeLearningWS
{
    [ServiceContract (Name="TranscriptService")]
    public interface iServiceInterface{...

Implementation

public class TranscriptService : iServiceInterface

Global.asax

namespace BiteSizeLearningWS
{
    public class Global : System.Web.HttpApplication
    {

        protected void Application_Start(object sender, EventArgs e)
        {
            RouteTable.Routes.Add(new ServiceRoute("TranscriptService", new WebServiceHostFactory(), typeof(TranscriptService)));  
        }
Was it helpful?

Solution

I think you have your:

<service name="BiteSizeLearningWS.iServiceInterface"...

name attribute value and the

<endpoint address="" ... contract="BiteSizeLearningWS.TranscriptService" />

contract attribute value mixed up. Try this:

<service name="BiteSizeLearningWS.TranscriptService"...

and

<endpoint address="" ... contract="BiteSizeLearningWS.iServiceInterface" />

If that works, then what happened is that WCF used the automatic default configuration values for the service instead of the invalid configuration shown in the question. The metadata endpoint is not enabled by default which would be why you're seeing the "disabled" message.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top