I am connecting to the SSRS 2008 ReportingService2005 reporting service through WCF.
I have a work 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 to give it a specific username / password, like this:
rService.ChannelFactory.Credentials.Windows.ClientCredential = new NetworkCredential(username, password, domain);
I get this error on the first method call:
An HTTP request is not authorized using the 'Ntlm client authentication scheme. The authentication header received from the server was "NTLM".
Here is the relevant part of my wcf binding configuration:
<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 am confused by the error message that mentions Ntlm in two different cases.
So the question is which of the two squillion different WCF settings do I need to bother 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 SSRS web.config:
<authentication mode="Windows" />
edit: For now, I will show the best answer, but it is still open, because I have not yet found a solution that allows me to set arbitrary credentials in the code.