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

Hi,

I am getting below error while trying to render SSRS report from C#-

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

C# configuration file

<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="ReportExecutionServiceSoap" closeTimeout="00:01:00"
                 openTimeout="00:01:00" receiveTimeout="00:10:00"
                 sendTimeout="00:10:00" maxBufferPoolSize="2147483647"
                 maxReceivedMessageSize="2147483647">
          <security mode="Transport">
            <transport clientCredentialType="Ntlm" proxyCredentialType="None" realm="" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://../ReportServer/ReportExecution2005.asmx"
        binding="basicHttpBinding" bindingConfiguration="ReportExecutionServiceSoap"
        contract="ReportExecution2005.ReportExecutionServiceSoap" name="ReportExecutionServiceSoap" />
    </client>
  </system.serviceModel>

Code accessing ssrs service-

                ReportExecutionServiceSoapClient rsExec = new ReportExecutionServiceSoapClient();
                rsExec.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;

                rsExec.LoadReport(trusteduserHeader, reportPath, historyID, out serviceInfo, out execInfo);
                execHeader.ExecutionID = execInfo.ExecutionID;

///

...

Thanks for your help

August 19th, 2015 2:53am

Hi Pramod,

The reason behind the following error

basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
instead of:
basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
Refer here: http://social.msdn.microsoft.com/Forums/en/sqlreportingservices/thread/2f382c26-ec6d-41a6-940d-d31e6248b185
https://randypaulo.wordpress.com/2011/10/27/ssrs-calling-reporting-services-using-wcf-and-using-the-html-output-for-email-notification/

Free Windows Admin Tool Kit Click here and download it now
August 19th, 2015 3:09am

Please also note that this problem comes only when accessing the ssrs service from different machine/domain.

This is working fine if accessing same service from server machine.

August 19th, 2015 3:10am

authentication mode "Ntlm" is already set in the configuration file.

 <transport clientCredentialType="Ntlm" proxyCredentialType="None" realm="" />

do i need to pass it from code behind?

Free Windows Admin Tool Kit Click here and download it now
August 19th, 2015 3:16am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics