Включить базовую аутентификацию для простой службы WCF?

У меня есть очень простой веб-сервис WCF, который клиент размещает на своем IIS.

У клиента есть собственный клиент, который он тестировал против него в своей среде тестирования, и все работало нормально, пока они не отключили анонимную аутентификацию и не включили базовую. Как только они это сделали, они начали получать ошибки:

The authentication schemes configured on the host ('Basic') do not allow those configured on the binding 'BasicHttpBinding' ('Anonymous'). Please ensure that the SecurityMode is set to Transport or TransportCredentialOnly. 

Итак, что мне нужно сделать, чтобы базовая аутентификация работала?

Текущий мой веб-сервисweb.config:

<configuration>
    <system.web>
        <compilation debug="true" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5" />
    </system.web>
    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="">
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
            multipleSiteBindingsEnabled="true" />
    </system.serviceModel>
</configuration>

У меня есть собственный тестовый клиент, который я могу запустить на своем веб-сервисе. Его токapp.config:

<configuration>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IMyServiceSvc" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost/MyServiceSvc.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyServiceSvc"
                contract="MyServiceSvc.IMyServiceSvc"
                name="BasicHttpBinding_IMyServiceSvc" />
        </client>
    </system.serviceModel>
</configuration>

Когда я устанавливаю службу на свой локальный IIS и запускаю на ней клиент, все работает, с включенной анонимной аутентификацией.

Что мне нужно сделать, чтобы включить базовую аутентификацию в IIS и настроить клиент и сервер для использования базовой аутентификации?

Мой текущий тестовый код клиента:

public class BlackHillsCompletionSvcTest
{
    static void Main(string[] args)
    {
        using (var client = new MyServiceSvcClient())
        {
            var data = new Data
            {
                id = "1",
                description = "test data"
            };

            try
            {
                var result = client.receiveData(data);
            }
            catch (Exception ex)
            {
                var msg = ex.Message;
            }
        }
    }
}

== Попытки: ==

Согласно предложению Панкаджа Капаре, я добавил это к веб-сервисуweb.config:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="httpBinding">
                <security mode="TransportCredentialOnly">
                    <transport clientCredentialType="Basic" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    ...
</system.serviceModel>

С этим я получил ошибку при создании клиента:

The binding at system.serviceModel/bindings/basicHttpBinding does not have a configured binding named 'BasicHttpBinding_IMyServiceSvc'. This is an invalid value for bindingConfiguration. 

Поэтому я добавил это к клиентуapp.config:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IMyServiceSvc">
                <security mode="TransportCredentialOnly">
                    <transport clientCredentialType="Basic" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    ...
</system.serviceModel>

С этим я получил еще одну ошибку:

The username is not provided. Specify username in ClientCredentials.

Поэтому я добавил имя пользователя и пароль в моем клиенте:

using (var client = new MyServiceSvcClient())
{
    client.ClientCredentials.UserName.UserName = "myusername";
    client.ClientCredentials.UserName.Password = "mypassword";
    ...
}

И с этим я получаю еще одну ошибку:

The requested service, 'http://localhost/MyServiceSvc.svc' could not be activated.  Which got me wondering. So I loaded the .svc page in my browser, was asked to log in, and after I did, I saw this:

The authentication schemes configured on the host ('Basic') do not allow those configured on the binding 'BasicHttpBinding' ('Anonymous').  Please ensure that the SecurityMode is set to Transport or TransportCredentialOnly.  Additionally, this may be resolved by changing the authentication schemes for this application through the IIS management tool, through the ServiceHost.Authentication.AuthenticationSchemes property, in the application configuration file at the <serviceAuthenticationManager> element, by updating the ClientCredentialType property on the binding, or by adjusting the AuthenticationScheme property on the HttpTransportBindingElement.

Что видит клиент.

Идеи?

== Может быть решение? ==

Я думаю, что, возможно, отсутствовало определение службы на сервере, связывающее привязку с конечной точкой:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="httpBinding">
                <security mode="TransportCredentialOnly">
                    <transport clientCredentialType="Basic" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <services>
        <service
                name="MyServiceSvcNs.MyServiceSvc"
                behaviorConfiguration="ServiceWithMetaData"
                >
            <endpoint name="Default"
                address=""
                binding="basicHttpBinding"
                bindingConfiguration="httpBinding"
                contract="MyServiceSvcNs.IMyServiceSvc"
                />
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior name="ServiceWithMetaData">
                <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
        multipleSiteBindingsEnabled="true" />
</system.serviceModel>

С этим, кажется, все работает. По крайней мере, на первый взгляд.

Ответы на вопрос(2)

Ваш ответ на вопрос