How to expose MEX when I need the service to have NTLM authentication
- by Ram Amos
I'm developing a WCF service that is RESTful and SOAP, now both of them needs to be with NTLM authentication.
I also want to expose a MEX endpoint so that others can easily reference the service and work with it.
Now when I set IIS to require windows authentication I can use the REST service and make calls to the service succesfully, but when I want to reference the service with SVCUTIL it throws an error that it requires to be anonymous.
Here's my web.config:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" maxReceivedMessageSize="214748563" maxBufferSize="214748563" maxBufferPoolSize="214748563">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm">
</transport>
</security>
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="webHttpBinding" maxReceivedMessageSize="214748563" maxBufferSize="214748563" maxBufferPoolSize="214748563">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm">
</transport>
</security>
</binding>
</webHttpBinding>
<mexHttpBinding>
<binding name="mexHttpBinding"></binding>
</mexHttpBinding>
</bindings>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" automaticFormatSelectionEnabled="true" helpEnabled="True">
</standardEndpoint>
</webHttpEndpoint>
</standardEndpoints>
<services>
<service name="Intel.ResourceScheduler.Service" behaviorConfiguration="Meta">
<clear />
<endpoint address="soap" name="SOAP" binding="basicHttpBinding" contract="Intel.ResourceScheduler.Service.IResourceSchedulerService" listenUriMode="Explicit" />
<endpoint address="" name="rest" binding="webHttpBinding" behaviorConfiguration="REST" contract="Intel.ResourceScheduler.Service.IResourceSchedulerService" />
<endpoint address="mex" name="mex" binding="mexHttpBinding" behaviorConfiguration="" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="REST">
<webHttp />
</behavior>
<behavior name="WCFBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="Meta">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
<behavior name="REST">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
<behavior name="WCFBehavior">
<serviceMetadata httpGetEnabled="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
<behavior name="">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- 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>
Any help will be appreciated.