Services > Report Services > Configuring FlexReports Web API > Using Standard Visual Studio Web API Template |
Complete the following steps to configure FlexReport Web API using standard Visual Studio Template for Web API:
Complete the following steps to configure Web API project:
licenses.licx |
Copy Code
|
---|---|
C1.Web.Api.LicenseDetector, C1.Web.Api C1.Web.Api.Report.LicenseDetector, C1.Web.Api.Report |
Startup.cs |
Copy Code
|
---|---|
public void Configuration(IAppBuilder app) { app.UseCors(CorsOptions.AllowAll); var folder = GetFullRoot("Files"); app.AddDiskStorage("root", folder); ConfigureAuth(app); } |
Note: Make sure you add Microsoft.Owin.Cors Nuget package in your application, for app.UseCors(); |
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; } |
Web.config |
Copy Code
|
---|---|
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="api/*" verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> |
Web.config |
Copy Code
|
---|---|
<system.webServer> <modules> <remove name="WebDAVModule" /> </modules> <handlers> <remove name="WebDAV" /> ......... </handlers> </system.webServer> |
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. |