3

I am trying to prevent annonymous access being allowed to my WCF service however i keep getting an error message "Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service."

I have tried various ideas such as removing the mex endpoint and setting the security mode as Transport credential only but this does not work.

Config:

My App pool identity is configured to a network account which sits on my domain, My Website has Anonymous access unticked and Integrated Windows Authentication ticked. My Service config is:

<services>      
  <service behaviorConfiguration="CRMDataDashboard_Service.CoreServiceBehavior"
    name="CRMDataDashboard_Service.CoreService">
    <endpoint address="http://crmb1:8900/CoreService.svc" binding="basicHttpBinding" contract="CRMDataDashboard_Service.ICoreService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
   </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="CRMDataDashboard_Service.Service1Behavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
    <behavior name="CRMDataDashboard_Service.ChartDataBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
    <behavior name="CRMDataDashboard_Service.DataDashboardServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
    <behavior name="CRMDataDashboard_Service.CoreServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>

Any help with this will be appreciated

Bruie
  • 1,195
  • 3
  • 11
  • 18

2 Answers2

0

Are you using basicHttpBinding?

This answer may help: IIS hosted WCF-service + Windows auth in IIS + TransportCredentialOnly/Windows auth in basicHttpBinding

Community
  • 1
  • 1
DaveRead
  • 3,371
  • 1
  • 21
  • 24
0

You need to create a binding in the config which defines windows authentication as transport security:

<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpEndpointBinding">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

Have a look here.


UPDATE

You need to put the above code just under <system.serviceModel>. You also need to point to the binding in your config (in bindingConfiguration use the BasicHttpEndpointBinding since this is what we have defined the binding as):

<endpoint address="http://crmb1:8900/CoreService.svc" binding="basicHttpBinding" contract="CRMDataDashboard_Service.ICoreService" bindingConfiguration="BasicHttpEndpointBinding">
  <identity>
Aliostad
  • 80,612
  • 21
  • 160
  • 208