I'm hooking into SSRS 2008's ReportingService2005 service via WCF.

I have it working with impersonation, like this:

```
ReportingService2005SoapClient rService = 
    new ReportingService2005SoapClient("endpoint config name", "the url");
rService.ClientCredentials.Windows.AllowedImpersonationLevel =
    System.Security.Principal.TokenImpersonationLevel.Impersonation;
rService.ChannelFactory.Credentials.Windows.ClientCredential =
    CredentialCache.DefaultNetworkCredentials;

```

But when I try and pass a specific username/password to it instead, like this:

```
rService.ChannelFactory.Credentials.Windows.ClientCredential = 
    new NetworkCredential(username, password, domain); 

```

I get this error on the first method call:

> 
> The HTTP request is unauthorized with client authentication scheme
>  'Ntlm'. The authentication header received from the server was 'NTLM'.
> 
> 
> 

Here's the relevant part of my wcf binding config:

```
<basicHttpBinding>
    <binding name="ReportingService2005Soap"  ... blah blah blah ...
        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="Ntlm" proxyCredentialType="Ntlm" realm=""/>
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </basicHttpBinding>

```

I'm confused by the error message mentioning Ntlm in two different cases.

So the question is - which of the two squillion different WCF settings do I need to fiddle with to get this to work? : ) 

edit: here is the authentication bit from RSReportServer.config from the SSRS server:

```
<Authentication>
    <AuthenticationTypes>
        <RSWindowsNegotiate/>
        <RSWindowsNTLM/>
    </AuthenticationTypes>
    <EnableAuthPersistence>true</EnableAuthPersistence>
</Authentication>

```

and from the SSRS web.config:

```
<authentication mode="Windows" />

```

edit: I'll mark the best answer so far for now, but this is still open because I havent yet found a solution that lets me set arbitrary credentials in code.