XtraReports Service Troubleshooting
- 6 minutes to read
This document explains the most commonly met errors and mistakes when using XtraReports in Silverlight applications.
If you are experiencing problems with running Silverlight projects, please proceed with the following steps to identify and solve those problems.
How to Identify an Error
Smoke test
Perform a “smoke test” (verify that the service activates successfully). To do this, try to open the report service file (.svc) separately in a Web browser.
To do this in the Visual Studio environment, right click it in the Solution Explorer and click View in Browser.
Or, if you have deployed the service to IIS hosting, navigate your Web browser to the address of your service (e.g. http://SomeComputer/BusinessApplication/ReportService.svc).
A successfully launched report service should look like something in the following image.
If the Web browser displays an exception message, proceed to the Typical Issues and Solutions section.
The service tracing and WCF message logging
You can use tracing instead of a debugger to understand how an application is behaving or why it faults. For more information, review the following topic: Tracing.
Other two options are:
- Using the WCF Service Configuration Editor to Enable Tracing and Message Logging
- Manual Editing of web.config
Use IE9 Developer tools for Web debugging
For easy and powerful Web debugging, you can use Internet Explorer 9 Developer tools. TFor more information, review the following article: Internet Explorer 9 Guide for Developers.
Using the WCF Service Configuration Editor to Enable Tracing and Message Logging
In the Visual Studio Main Menu, expand Tools and run the WCF Service Configuration Editor.
- In the dialog, locate and open the web.config file.
Then, in the Configuration tree to the left, select the Diagnostics node. On the right pane, make the following modifications.
- Enable Log Auto Flush;
- Enable Message Logging (change the log level to include all three options: malformed, service and transport messages);
- Enable Tracing.
Back in the Configuration tree on the left, Select Diagnostics | Message Logging. On the right pane, make the following modifications.
-LogMalformedMessages = true;
- LogEntireMessage = true;
- LogMessagesAtServiceLevel = true;
- LogMessagesAtTransportLevel = true;
- MaxMessagesToLog = 10000;
- for the MaxSizeOfMessageToLog property, increase the default value (4194304 should be enough in most cases).
- Save the changes, and close the editor.
Manual Editing of web.config
Without using the WCF Service Configuration Editor, you can edit the web.config manually. This approach is less recommended, because it is more fraught with errors.
First, add the diagnostics section to system.serviceModel.
<system.serviceModel> <diagnostics> <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="1000000" maxSizeOfMessageToLog="4194304" /> </diagnostics> </system.serviceModel>
Then, add the following section.
<system.diagnostics> <sources> <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing"> <listeners> <add type="System.Diagnostics.DefaultTraceListener" name="Default"> <filter type="" /> </add> <add name="ServiceModelMessageLoggingListener"> <filter type="" /> </add> </listeners> </source> <source name="System.ServiceModel" switchValue="Warning,ActivityTracing" propagateActivity="true"> <listeners> <add type="System.Diagnostics.DefaultTraceListener" name="Default"> <filter type="" /> </add> <add name="ServiceModelTraceListener"> <filter type="" /> </add> </listeners> </source> </sources> <sharedListeners> <add initializeData="D:\Web_messages.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp"> <filter type="" /> </add> <add initializeData="D:\Web_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp"> <filter type="" /> </add> </sharedListeners> <trace autoflush="true" /> </system.diagnostics>
- In addition, depending on your server configuration, it might be necessary to modify the path to Web_messages.svclog and Web_tracelog.svclog files.
Typical Issues and Solutions
An incorrect deployment
Error:
The type ‘DevExpress.XtraReports.Service.ReportService, DevExpress.XtraReports.v11.1.Service, Version=11.1.5.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx’, provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
Solution:
First, make sure that the report type name specified in the .svc file (including the assembly name, version, culture and public key token) is correct. Then, use the Assembly Binding Log Viewer to analyze the assembly loading failure.
Alternatively to using the Assembly Binding Log Viewer, you can create a test ASP.NET page.
<%@ Page Language="C#" %> <%@ Import Namespace="System.Runtime.Remoting" %> <% ObjectHandle handler = Activator.CreateInstance("DevExpress.XtraReports.v11.1.Service", "DevExpress.XtraReports.Service.ReportService"); Response.Write(handler.Unwrap().ToString()); %>
Add this page to the web project with the ReportService, and open it in the browser. The browser will display an extended error message about the assembly loading failure.
To do this in Visual Studio, you should first launch the project (with IIS, the site is already hosted, so there is no need in doing so).
The default database configuration and x64 machine
Error:
Unable to open database. Connection string: ‘Provider=Microsoft.Jet.OLEDB.4.0;Mode=Share Deny None;data source=|DataDirectory|/ReportService.mdb;user id=Admin;password=;’; Error: ‘System.InvalidOperationException: The ‘Microsoft.Jet.OLEDB.4.0’ provider is not registered on the local machine.
Solution:
ReportService uses a database to keep its session state. An MS Access® database is used by default. However, there is no MS Access® .NET database provider for x64 systems. So, you should use any other database supported by XPO that can run on x64 operation systems.
Insufficient permissions to open or modify the database
Error:
Unable to open database. Connection string: ‘Provider=Microsoft.Jet.OLEDB.4.0;Mode=Share Deny None;data source=ReportService.mdb;user id=Admin;password=;’; Error: ‘System.Data.OleDb.OleDbException (0x80004005): Could not find file ‘C:\WINDOWS\system32\ReportService.mdb’.
Solution:
Add the xpf.printing connection string to the web.config. If a file-based database is used (e.g. MS Access®), make sure that the database file exists in the specified folder (we recommend to use the App_Data folder for this purpose), and that your application has enough rights to read and modify it.
Error:
System.ServiceModel.FaultException: Database schema could not be updated.
Solution:
This exception can be usually met after a major XtraReports update. To solve this problem, you should remove all tables from the database repository that is used by the Report Service for storing temporary data (generated documents, files ready for export and so on). To learn more about the Report Service, see Silverlight Reporting Overview.
The wrong start-up project
Error:
The provided URI scheme ‘file’ is invalid; expected ‘http’.
Solution:
Make the server be a part of the application start-up project.
You can catch this error by adding the following code to the client part of your application (App.xaml.cs or Application.xaml.vb).
private void Application_Startup(object sender, StartupEventArgs e) { if (string.Compare("file", Host.Source.Scheme, StringComparison.InvariantCultureIgnoreCase) == 0) { const string message = "Please make sure that the Web project of this solution is the starting project."; MessageBox.Show(message); return; } this.RootVisual = new MainPage(); }
In this case, after launching the application, if the wrong start-up project is defined, an in-browser error message is shown.