Request failed with HTTP status 401: Unauthorized
I have the following error: Request error with HTTP status 401: Unauthorized. URL: http: //serverName/ReportServer/ReportService2005.asmx
I have a web application on the same server and a reporting service and the other.both server has Windows 2003 installed. The user in the sorts is the same thing I use to install the reporting service and the same Reportins service. In addition, this user has the RSS role and is the owner of the database, and this user is a member of the application pool. is there something wrong in my code? what is the way to access the reporting service web service using impersonation?
{
ReportingService2005 rs = new ReportingService2005();
try
{
rs.Url = ConfigurationSettings.AppSettings["WSRS"].ToString();
//rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rs.PreAuthenticate = true;
rs.Credentials = new NetworkCredential(RS.User_Name,RS.Pass_Word,RS.Domain)
);
//string report = "/SampleReports/Employee Sales Summary";
string desc = "Added by workflow automatically";
string eventType = "TimedSubscription";
string scheduleXml = string.Empty;
/*ExtentionSettings Values*/
List<ParameterValue> ExtensionSettingsparmList = new List<ParameterValue>();
foreach (String name in colExtensionSettings.AllKeys)
{
ExtensionSettingsparmList.Add(new ParameterValue() { Name = name, Value = colExtensionSettings[name].ToString() });
}
ExtensionSettings extSettings = new ExtensionSettings();
extSettings.ParameterValues = ExtensionSettingsparmList.ToArray(); // extensionParams;
extSettings.Extension = "Report Server Email";
/*Parameters Values*/
List<ParameterValue> parameterList = new List<ParameterValue>();
foreach (String name in colParameters.AllKeys)
{
parameterList.Add(new ParameterValue() { Name = name, Value = colParameters[name].ToString() });
}
scheduleXml = @"<ScheduleDefinition><StartDateTime>" + DateTime.Now.AddMinutes(1).ToString("s") + "</StartDateTime></ScheduleDefinition>";
string matchData = scheduleXml;
return rs.CreateSubscription(report, extSettings, desc, eventType, matchData, parameterList.ToArray());
}
+1
HANK
a source
to share
2 answers