Yuri
Yuri

Reputation: 2900

'System.ServiceModel.Security.MessageSecurityException' in WCF

I have WCF client with the following config.

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="MyService" closeTimeout="00:01:00"
                    openTimeout="00:01:00" 
                    receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" 
                    bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" 
                    maxBufferPoolSize="524288" 
                    maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" 
                        maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://myservername/MyGreatServices/MyService.svc"
          binding="basicHttpBinding" bindingConfiguration="MyService"
          contract="XXX.Ixxx" name="MyService" />
    </client>
 </system.serviceModel>

but when trying to run application getting an error:

An exception of type 'System.ServiceModel.Security.MessageSecurityException' occurred in mscorlib.dll but was not handled in user code Additional information: The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate oXoweKADCgEBonEEb2BtBgkqhkiG9xIBAgIDAH5eMFygAwIBBaEDAgEepBEYDzIwMTYwMTEyMjAwNDAwWqUFAgMH13imAwIBKakUGxJVUy5LV09STEQuS1BNRy5DT02qGzAZoAMCAQGhEjAQGw51c21kY2tkYXAxMDg3JA=='.

On the IIS both Anonimous and Windows authentication are enabled

Upvotes: 0

Views: 9453

Answers (1)

Mohanad Haddadin
Mohanad Haddadin

Reputation: 589

change

<transport clientCredentialType="Windows" />

to

<transport clientCredentialType="Ntlm" />

Upvotes: 3

Related Questions