by Phil Adams
24. November 2010 00:51
Ok, Today i had this error with one of our client servers, now this is a new install then immediately patched to Update Rollup 12.When trying to run any report you get the error:
"The base class includes the field 'reportViewer', but its type (Microsoft.Reporting.WebForms.ReportViewer) is not compatible with the type of control (Microsoft.Reporting.WebForms.ReportViewer)."
Screenshot:
So after a bit of research found that the Report Webviewer was updated from 2005 to 2008, but if the web.config has been modified the rollup doesn't upgrade the web.config file, well now this is strange as this was a fresh install and a straight upgrade.........
well after a bit of digging around the update files i found the entries that needed to be updated(see below), so updated these and voila!!!
Please change the entries in your web.config at the root of your CRM siteUnder the HttpHandlers Section find:Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3aAnd replace with:Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3aUnder the Assemblies Section find:Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3aAnd replace with:Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3aHope this helps others.Phil
by Phil Adams
27. September 2010 16:59
Enabling remote errors for SQL Server Reporting Services means setting EnableRemoteErrors Reporting Services system property to True
There are two ways to set the EnableRemoteErrors property to True for a Reporting Services instance.
Update ReportServer database Configuration table for EnableRemoteErrors
The first way is updating the ConfigurationInfo table which is in the ReportServer database for configuration record named "EnableRemoteErrors".The default value for EnableRemoteErrors property in the ConfigurationInfo database table is "False". You can simply run an update sql statement to enable remote errors.But you may not be successfull to see the changes made on the ConfigurationInfo table on the Reporting Services application, if the application is being used intensely.
Enable EnableRemoteErrors property though running a script
Second way to enable remote errors is using and running a script which updates the running configuration values of the Reporting Services.The codes of the script that will update configuration values for EnableRemoteErrors is given in the SQL Server 2005 Books Online.I chosed this method for solution in my problem. And this method successfully worked for my case.Here is the script codes :
Public Sub Main()Dim P As New [Property]()P.Name = "EnableRemoteErrors"P.Value = TrueDim Properties(0) As [Property]Properties(0) = PTryrs.SetSystemProperties(Properties)Console.WriteLine("Remote errors enabled.")Catch SE As SoapExceptionConsole.WriteLine(SE.Detail.OuterXml)End TryEnd Sub
Copy the above script code in an empty text file and as the script file as EnableRemoteErrors.rss on the root folder of your C drive.Of course you can select an other name for the script file name and an other folder to save your script. I chosed C drive to keep it easy to run the below command promt statement.Open the command promt window by running the "cmd" command in the "Run" box. Then run the below command after you have replaced the ReportServerName with the actual name of the Reporting Services server you want to configure and the ReportServer instance name. You can keep ReportServer unchanged if you use the default configurations.
rs -i C:\EnableRemoteErrors.rss -s http://ReportServerName/ReportServer
Enabling remote errors for a Reporting Services may help you to get more detailed information that may help for troubleshooting problems with Reporting Services applications and reports you are developing, but do not forget that this is against security rules or general security policies.Keep the times you enable remote errors for your Reporting Services server short.You can then disable remote errors again by setting EnableRemoteErrors property to "False" by using any of the above methods. But this time set the EnableRemoteErrors to False instead of True.
Other Reporting Services Properties kept in ConfigurationInfo table in ReportServer database
Here you can find a list of all SQL Server Reporting Services properties and default values kept in ReportServer database ConfigurationInfo table
•Name : EnableClientPrinting Value : True•Name : EnableExecutionLogging Value : True•Name : EnableIntegratedSecurity Value : true•Name : EnableLoadReportDefinition Value : True•Name : EnableMyReports Value : False•Name : EnableRemoteErrors Value : False•Name : EnableReportDesignClientDownload Value : True•Name : ExecutionLogDaysKept Value : 60•Name : ExternalImagesTimeout Value : 600•Name : MyReportsRole Value : My Reports•Name : SessionTimeout Value : 600•Name : SharePointIntegrated Value : False•Name : SiteName Value : SQL Server Reporting Services•Name : SnapshotCompression Value : SQL•Name : StoredParametersLifetime Value : 180•Name : StoredParametersThreshold Value : 1500•Name : SystemReportTimeout Value : 1800•Name : SystemSnapshotLimit Value : -1•Name : UseSessionCookies Value : true
by Phil Adams
22. March 2010 14:50
In BIDS, do the following:
Click on Report > Report Properties > Layout tab
Make a note of the values for Page width, Left margin, Right margin
Close and go back to the design surface
In the Properties window, select Body
Click the + symbol to expand the Size node
Make a note of the value for Width
To render in PDF correctly Body Width + Left margin + Right margin must be less than or equal to Page width. When you see blank pages being rendered it is almost always because the body width plus margins is greater than the page width.
Remember: (Body Width + Left margin + Right margin) <= (Page width)
by Phil Adams
16. August 2009 20:34
Below is a Generic SSRS web service reporting method that generates a byte[] perfect for use in an annotation or email attachment. The example method above it shows how to call this method and how to create an annotation attachment. You can combine this with my post on driving email templates and generating email attachments to create some very powerful solutions. If you need a primer on activity parties see my post on creating activity parties. Generating SSRS reports by web service is a very valuable tool. I frequently use this to generate custom reports from custom web applications running in iframes such that the report is run with the permissions of the user running the report. To take advantage of this the reports must be run against MS CRM’s filtered views. To Generate an SSRS report by web service do the following: 1. Add a report execution web reference to your solution. Make sure this link is accessible. The url should be something like the following: http://<SRS_Server_Name>/ReportServer/ReportExecution2005.asmx 2. Build up the parameters that you need to generate the report. 3. Select the Report Name of your Report 4. Specify the Type of Report 5. Specify the Device information ( formatting ) The example method CallReport() below demonstrates these steps. It in turn calls GenerateSRSbytes which makes the actual web service call. using System.Net;
using Microsoft.Win32;
using ReportExecutionService;
public class SRSReporting
{
public void CallReport()
{
string reportServiceUrl = "http://<SRS_Server_Name>/ReportServer/ReportExecution2005.asmx";
// Create the Report Service Url from the registry
RegistryKey key = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\MSCRM", false);
if (key != null)
{
reportServiceUrl = (string)key.GetValue("SQLRSServerURL") + @"/ReportExecution2005.asmx";
}
// Report parameter Name and Value fields are strings.
string reportParameter = "type";
string reportValue = "annual";
// Create as many parameters as you need.
var parameters = new[]
{
new ParameterValue {Name = "entityid", Value = "0031a390-0d42-de11-9aa9-0003ff517b20"},
new ParameterValue {Name = reportParameter, Value = reportValue}
};
// Pathname to the report from Reporting Services, where TestReport is the rdl uploaded using http://<SRS_Server_Name>/Reports
// Make sure that you set the Data Source properly
// Make sure to set security properly
string reportName = "/AutomatedCRMReporting/TestReport";
// Specify what type of report you want to create HTML,PDF, CVS, Excel, Word, XML, MHTML, Image
string reportFormat = "PDF";
// Specify the device information to control the output of your report.
//For device information See http://msdn2.microsoft.com/en-us/library/ms155397.aspx
string deviceInformation = "<DeviceInfo><DpiX>240</DpiX><DpiY>240</DpiY><StartPage>0</StartPage></DeviceInfo>";
// Generate a report in a format for a CRM annotation or email attachment
byte[] generatedReport = GenerateSRSbytes(reportName, parameters, reportFormat, deviceInformation, reportServiceUrl, null, null, null);
// An example attachment created from an SRS report
//var newAnnotation = new annotation
// {
// objectid = CrmTypes.CreateLookup(regardingEntity, regardingId),
// objecttypecode = CrmTypes.CreateEntityNameReference(EntityName.contact.ToString()),
// isdocument = CrmTypes.CreateCrmBoolean(true),
// ownerid = CrmTypes.CreateOwner(EntityName.systemuser.ToString(), ownerId),
// filename = reportFileName,
// documentbody = Convert.ToBase64String(generatedReport),
// filesize = CrmTypes.CreateCrmNumber(generatedReport.Length),
// subject = reportFileName
// };
//service.Create(newAnnotation);
}
/// <summary>
/// Generates an SSRS Report and returns a byte[] for a CRM attachment
/// </summary>
/// <param name="reportPath">Name of the report.</param>
/// <param name="parameters">The parameters.</param>
/// <param name="outputFormat">The output format.</param>
/// <param name="deviceInformation">The device information. See http://msdn2.microsoft.com/en-us/library/ms155397.aspx</param>
/// <param name="ReportServiceUrl"></param>
/// <param name="userName">if null, DefaultNetworkCredentials are used</param>
/// <param name="passWord">if null, DefaultNetworkCredentials are used</param>
/// <param name="domainName"></param>
/// <returns></returns>
public static byte[] GenerateSRSbytes(string reportPath, ParameterValue[] parameters, string outputFormat, string deviceInformation, string ReportServiceUrl, string userName, string passWord, string domainName)
{
string encoding;
string mimeType;
string extension;
string[] streamIDs;
string SessionId;
string historyID = null;
Warning[] warnings;
// By default the Report will run with the permissions of the AD authenticated User.
var rs = new ReportExecutionService.ReportExecutionService
{
Credentials = System.Net.CredentialCache.DefaultNetworkCredentials,
Url = ReportServiceUrl
};
// Impersonate credentials if they are specified.
if (userName != null && passWord != null)
{
if (domainName == null)
{
rs.Credentials = new NetworkCredential(userName, passWord);
}
else
{
rs.Credentials = new NetworkCredential(userName, passWord, domainName);
}
}
// Set timeout in seconds of the report takes a long time.
//rs.Timeout = 600000;
ExecutionHeader execHeader = new ExecutionHeader();
rs.ExecutionHeaderValue = execHeader;
var execInfo = new ExecutionInfo();
execInfo = rs.LoadReport(reportPath, historyID);
rs.SetExecutionParameters(parameters, "en-us");
SessionId = rs.ExecutionHeaderValue.ExecutionID;
// Render Report
return rs.Render(outputFormat, deviceInformation, out extension, out mimeType, out encoding, out warnings, out streamIDs);
}
}
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
Happy Coding!
CRMScape - Mark Kovalcson's MS CRM Development Blog