NibblyPig
NibblyPig

Reputation: 52952

Unable to get MEX to work with my WCF service

I think it may be due to not having/requiring any base address to be specified in the config. Everything else works fine, including publishing WSDL, calling the service, etc. but when I add a MEX endpoint and try to access it, it returns 503 service unavailable.

My web.config looks like this:

<system.serviceModel>
  <bindings>
    <basicHttpsBinding>
      <binding name="ServiceBinding" />
    </basicHttpsBinding>
  </bindings>
  <services>
    <service name="MyServices.CatService" behaviorConfiguration="MyBehavior">
      <endpoint address="" binding="basicHttpsBinding" bindingConfiguration="ServiceBinding" contract="MyServices.ICatService"></endpoint>
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior name="MyBehavior">
        <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
        <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
        <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
        <serviceDebug includeExceptionDetailInFaults="false" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>

When I browse to my service, I get the message:

You have created a service. To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax: svcutil.exe http://[mypc]/MyServices/CatService.svc/mex

I'm reasonably sure it's to do with the way the endpoints are defined, but I don't know how to fix it. Any ideas?

Upvotes: 1

Views: 1017

Answers (1)

NibblyPig
NibblyPig

Reputation: 52952

Solved - the mex example above that I copied and pasted in is http, not https. I changed it mexHttpsBinding and it worked great. I think http didn't work due to some configuration of running http locally but I am not sure.

Upvotes: 2

Related Questions