Services > Report Services > Configuring FlexReports Web API > Using ComponentOne Web API Edition Template |
If you have installed Web API Edition from C1Studio installer, then it is easy to create a project pre-configured with FlexReport Web API. Use the C1 Web API Template to create a new project named FlexreportWebAPI and follow the steps below:
Complete the following steps to add report files to your application.
Note: Make sure you add Microsoft.Owin.Cors Nuget package in your application, for app.UseCors(); |
Startup.cs |
Copy Code
|
---|---|
app.UseCors(CorsOptions.AllowAll); app.UseReportProviders() .AddFlexReportDiskStorage("ReportsRoot", GetFullRoot("Files")) |
This code registers the folder/location where the Report files will be stored, in this case it is the "Files" folder.
Startup.cs |
Copy Code
|
---|---|
private static string GetFullRoot(string root) { var applicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; var fullRoot = Path.GetFullPath(Path.Combine(applicationBase, root)); if (!fullRoot.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal)) { fullRoot += Path.DirectorySeparatorChar; } return fullRoot; } |
The Web API URL, for service hosted on local IIS, will be http://localhost/FlexReportwebAPI/api/report.
Note: Once you have successfully created Web API URL for Report Services, you can access and view reports stored in the service using FlexViewer for MVC and Wijmo Viewer. For more information on how to view reports, see Viewing Reports in FlexViewer. |