Git Product home page Git Product logo

crystalreportscloudservicetemplate's Introduction

Crystal Reports Cloud Service

Crystal reports cannot be installed on Azure WebSites. This project provides a template as a reference to create a cloud Service with Crystal Reports installed. The service generates the reports as PDF stored them on your storage account and then provide an expiring URL that the user can use to open the generated PDF. This is a very basic implementation and is just provided as an starting point.

To run the code from this template.

  1. Add all your reports to the project and set them as content with copy always settings.
  2. Create an storage account
  3. Add an entry on the Web.Config <appSettings> section. For example:
<add name="StorageConnectionString" connectionString=" <StorageConnectionString> "/>

Using the Cloud Service

The cloud service is exposed thru Web API

The following example shows how to invoke the cloudservice

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Diagnostics;

namespace TestCloudServiceWebAPI
{
    public class ReportInfo
    {
        public string ReportName { get; set; }
        public string TenantName { get; set; }
        public string Token { get; set; }
    }

    public class ReportDefinitionInfo
    {
        public string Url { get; set; }
    }


    class Program
    {
        static void Main(string[] args)
        {

            var client = new HttpClient();
            var baseAddress = "http://<your cloud service address>.cloudapp.net/";
            client.BaseAddress = new Uri(baseAddress);
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));


            var reportInfo = new ReportInfo() { ReportName = "SampleReport.rpt", TenantName = "Tenant1", Token = Guid.NewGuid().ToString() };

            var st = new Stopwatch();
            st.Start();
            HttpResponseMessage response = client.PostAsJsonAsync("api/crystalreports", reportInfo).Result;
            st.Stop();
            response.EnsureSuccessStatusCode();
            var res = response.Content.ReadAsAsync<ReportDefinitionInfo>().Result;
            Console.WriteLine($"Call processed in {st.ElapsedMilliseconds} ms");

        }
    }
}

Deployment Observations

The recommendation is to setup a virtual network and make sure that the cloud services is only accesible to your azure websites, in that way the communication of report parameters is not exposed.

#NOTE: The latest Crystal Reports Runtime installer can be downloaded from: https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

This installer is called from Startup.cmd

Remember to update the Startup.cmd script if you download a new version.

crystalreportscloudservicetemplate's People

Contributors

orellabaccr avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.