3
Reply

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

ales_pac

ales_pac

Nov 14 2011 11:19 AM
6.5k
Hi....

I try to use

Reporting services 2008 with aspnet and have this exception

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

this is the code

----------------------------

ReportExec.ReportExecutionServiceSoapClient rsc = new ReportExec.ReportExecutionServiceSoapClient();
//rsc.Credentials = System.Net.CredentialCache.DefaultCredentials;
//rsc.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
System.Net.NetworkCredential NCCred = new System.Net.NetworkCredential(username, accesspwd);
//rsc.ClientCredentials.Windows.ClientCredential = NCCred;
rsc.ClientCredentials.UserName.UserName = username;
rsc.ClientCredentials.UserName.Password = accesspwd;
rsc.ClientCredentials.HttpDigest.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
//rsc.Url = "http://MySqlServer.MyDomain.com/reportserver/ReportExecution2005.asmx";

// Render arguments
byte[] result = null;

// Make sure you use your correct org database name of the following line
string reportPath = "/" + reportFolder + "/" + reportName;
//string format = "PDF";
string historyID = null;
string devInfo = null;
// Prepare report parameter.

ParameterValue[] param = new ParameterValue[par.Length];
for (int i = 0; i < par.Length; i++)
{
param[i] = new ParameterValue();
param[i].Name = par[i].Key;
param[i].Value = par[i].Value;
}
string encoding;
string mimeType;
string extension;
ReportExec.Warning[] warnings = null;
//ReportExec.ParameterValue[] reportHistoryParameters = null;
string[] streamIDs = null;
ReportExec.ExecutionInfo execInfo = new ReportExec.ExecutionInfo();
ReportExec.ExecutionHeader execHeader = new ReportExec.ExecutionHeader();
//rsc.ExecutionHeaderValue = execHeader;
ReportExec.ServerInfoHeader SIHheader = null; // new ReportExec.ServerInfoHeader();
ReportExec.TrustedUserHeader TUHheader = null; // new ReportExec.TrustedUserHeader(); //null;//
//TUHheader.UserName = username;
//rsc.SetExecutionCredentials(execHeader, TUHheader, null, out execInfo);
rsc.LoadReport(TUHheader, reportPath, historyID, out SIHheader, out execInfo);

//rs.SetExecutionParameters(parameters, "en-us");
//String SessionId = SIHheader.ExecutionID;
//Console.WriteLine("SessionID: {0}", rs.ExecutionHeaderValue.ExecutionID);

rsc.Render(execHeader, TUHheader, format, devInfo, out result, out extension, out mimeType, out encoding, out warnings, out streamIDs);
return result;

----------------------------

this is the web.config

----------------------------

  <system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ReportExecutionServiceSoap" 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" />
<!-- error The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM'.
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
-->
<!-- error The HTTP request is unauthorized with client authentication scheme 'Basic'. The authentication header received from the server was 'NTLM'.
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
-->
<!-- error The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'NTLM'
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="Windows" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
-->
<!-- ask Https
<security mode="Transport">
<transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
-->

<!-- error The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'NTLM'.
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="Windows" realm="" />
<message clientCredentialType="UserName"/>
</security>
-->
<!-- error The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'NTLM'.
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" realm="" />
<message clientCredentialType="UserName"/>
</security>
-->

<!-- error The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'NTLM'.  
           -->
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName"/>
</security>


</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://MyIp:8080/ReportServer/ReportExecution2005.asmx"
binding="basicHttpBinding" bindingConfiguration="ReportExecutionServiceSoap"
contract="ReportExec.ReportExecutionServiceSoap" name="ReportExecutionServiceSoap" />
</client>
</system.serviceModel>

----------------------------

please help me

It runs on Windows XP SP3...

VisualStudio 2010


TIA

Alessandro


Answers (3)