5,781,349 members and growing! (55 online)
Email Password   helpLost your password?
Platforms, Frameworks & Libraries » Cross Platform » General     Intermediate

ASP.NET Reports Starter Kits Porting from Windows to Linux (Race to Linux)

By Abishek Bellamkonda

ASP.NET Reports Starter Kit Porting from Windows to Linux using Mainsoft's Grasshopper
C#, SQL, HTML, Linux, Windows, .NET, .NET 1.1SQL 2000, IIS 5, IIS 5.1, IIS 6, VS.NET2003, IE 6.0, SQL Server, IIS, Visual Studio, IE, DBA, Dev

Posted: 30 Sep 2005
Updated: 30 Sep 2005
Views: 15,946
Bookmarked: 7 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
4 votes for this Article.
Popularity: 1.99 Rating: 3.30 out of 5
1 vote, 25.0%
1
0 votes, 0.0%
2
0 votes, 0.0%
3
1 vote, 25.0%
4
2 votes, 50.0%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article

Introduction

The scenario is to port one of the ASP.NET starter kits from Windows to Linux using cross-platform of choice (like Grasshopper, Mono, PHP, Macromedia and so on). We can use existing SQL Server (which ASP.NET Reports already works with) or any other database like MySQL, PostgreSQL and so on.

My Choice

Among the 4 choices I decided to go ahead with Grasshopper. Although Mono is a very good too.

Reports starter kit is proven to work with SQL Server, I didn't want to fix it when it is not broken. I simply choose to use Hosted SQL Server instead of migrating to MySQL, PostgreSQL and so on.

Grasshopper Setup

  1. Download and install Grasshopper from http://dev.mainsoft.com/Default.aspx?tabid=28. Tomcat is installed as part of Grasshopper installation.
  2. Download and install 'Directory Services' and 'Drawing' Beta components files from http://dev.mainsoft.com/Default.aspx?tabid=28. Don't forget to updated the Grasshopper runtime with the System.DirectoryServices modules. Though they are Beta, they worked quite well for me. Doing so will save some time GOOGLING for errors during build. Though Directory Services is not required for this project it might be required for future project, so you might consider downloading it.

Reports Starter Kits Setup

  1. Download and install ASP.NET Reports Starter Kit from http://www.asp.net/Default.aspx?tabindex=8&tabid=47.
  2. Go with default options which installing the Reports Starter Kit

Our Windows to Linux Port

  1. Start Tomcat (Go to Start-->All Programs-->Visual MainWin for the J2EE(TM) platform and click Start Tomcat).
  2. Open Reports Starter Kit Visual Studio Solution (Go to Start-->All Programs-->ASP.NET Starter Kits-->ASP.NET Reports (CSVS) click ASP.NET Reports Starter Kit (CSVS).sln).
  3. Right click the ReportsCSVS project and hit 'Generate J2EE project'. A wizard will be open, follow the below steps...
    • Hit Next button.
    • Check 'Save a copy of the original solution file' and hit Finish button.
    • Grasshopper takes couple of minutes, let it finish.
  4. A New Project (ReportsCSVS.J2EE) will be added to the current solution.
  5. Right Click ReportsCSVS.J2EE Project and hit Build, wait until the Java conversion completes (takes a minute or two).
  6. Now you might have noticed some warnings, there will be some little issues which we will be discussing below. Once we fix them all we will rebuild the solution to get the application working.

Challenges (I like to call issues)

We will address the issues that occur during the Windows to Linux porting process. Practically we discover and solve all the issues during build and testing time. For this project the easiest issues are build time errors or warning.

  1. Fortunately, there are no build time errors, but we have 3 warnings here.
    warning JC8000: Not Implemented Element 'customErrors'
    warning JC8000: Not Implemented Element 'sessionState'
    warning JC8000: Not Implemented Element 'pages'
    
    All these warnings are from web.config file and are due to the fact customErrors, sessionState and pages are unsupported elements. The solution is to comment them out in web.config.
  2. Now it all seems to have compiled successfully and when I run the application I see the error 'JDBC' error. My connection string was like below...
    <add key="ConnectionString" value="server=localhost;Trusted_Connection=true;database=Reports" />
    
    The problem seems to be that my starter kit installation was using 'localhost' for server in web.config's ConnectionString's property. I had to change it to 'HOME' (my home PC). Then I discovered that it had troubles connecting using 'Trusted connection', as my SQL Server didn't give any permission. I changed the connection string to use username/password instead of Trusted connection as below...
    <add key="ConnectionString" value="server=HOME;Trusted_Connection=true;database=Reports;user id=sa;password=" />
    
    Issues #2 fixed. Note: It looks like we have to rebuild whenever we change the connectionString in web.config, otherwise the application is not picking it up.
  3. Everything seem to be working nicely, I ran the application and started testing every report. Boom, the Visual.aspx was not showing the Pie or Bar charts properly, they had blank images there. I started debugging the application (please go through http://dev.mainsoft.com/Default.aspx?tabid=32&src=ww_DebuggingProjects.html to setup and start debugging) and found that there was a condition and the ChartGenerator.aspx page will display the bar/pie chart only if the condition is satisfied. When I looked closed at the condition in ChartGenerator.aspx, it was trying to display the chart to only users that come from the our ReportsCSVS site as shown below.
    if (Request.UrlReferrer != null &&((Request.UrlReferrer.Host.ToLower() == Environment.UserDomainName.ToLower()) 
                    || Request.UrlReferrer.Host.ToLower() == "localhost"))
    
    I realised that there was actually a 4th warning which I didn't notice earlier; it says...
    Not Implemented Property system.Environment.UserDomainName
    I implemented this condition to use Request.Url.Host instead of Environment.UserDomainName property and rebuilt the solution.
  4. All reports seem to be working very fine. After going through all of them I found one more issue. It is a little thing, the image in Simple Report Overview was missing. At first I though it might be some Charting error again. But, it turned out that it was a HTML page (Simple.htm) which was using an image. This image was missing when I view it in the browser (IE 6). When I looked at the img tag, I couldn't sport the error, when I rewrote the line myself I found that the image extension of 'SimpleOverview' image was '.PNG' instead of '.png' in Docs/Simple.htm file, which actually caused the culprit. Renaming it to '.png' fixed the problem. It probably looked like Tomcat was case sensitive.

Package and Deploy

  1. Right click the ReportsCSVS.J2EE project and click 'Deployment Packager', grasshopper will create a WAR file (J2EE deployment file). Due to size limitations i didn't choose the 'Create self-contained package, which includes the whole Visual MainWin framework' (13MB) option. Choose the options as shown in the image below...
    Creating the WAR file in Visual Studio .NET.
    My project has two WAR files (ASPNET.StarterKit.Reports.war and ReportsCSVS.J2EE.war) and a ReportsCSVS.J2EE.deployWar file, in the bin_Java folder.
  2. Tomcat management console can be used to upload & deploy the WAR file to install the application. Based on Application Server your project is associated with Grasshopper can deploy the application itself.
I can view my application in IIS at http://localhost/ReportsCSVS/Default.aspx and in Tomcat at http://localhost:8080/ReportsCSVS/Default.aspx.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Abishek Bellamkonda


In software, if no one in world can do it, give me a call !

Started programming when i was a kid with 286 computers and Spectrum using BASIC from 1986. There was series of languages like pascal, c, c++, ada, algol, prolog, assembly, java, C#, VB.NET and so on. Then shifted my intrest in Architecture during past 5 years with Rational Suite and UML. Wrote some articles, i was member of month on some sites, top poster(i only answer) of week (actually weeks), won some books as prizes, rated 2nd in ASP.NET and ADO.NET in Australia.

In short, i like SPEED of development. When you get the messy part in project "The fun begins and it gets intresting".
Occupation: Architect
Location: Australia Australia

Other popular Cross Platform articles:

  • Introduction to Mono - Your first Mono app
    The first in a series of articles about Mono. This article explains how to install Mono and shows how to compile your first Cross Platform application.
  • MONO: an alternative for the .NET framework
    This article presents possibilities for development of .NET applications running on operating systems other than Windows, using the MONO platform. Advantages and challenges will be presented. Also presented are some common issues encountered while developing applications using the .NET technology.
  • Embed ActiveX controls inside Java GUI
    With this your Java projects can take advantage of ActiveX controls and Office documents such as spreadsheets, charts, calendars, word processors, specialized graphics, and many more.
  • Introduction to Mono - ASP.NET with XSP and Apache
    The second article in a series of articles about Mono. This article explains how to host and serve ASP.NET Web Applications and Web Services on Linux using XSP and Apache with the help of Mono.
  • Phalanger, PHP for .NET: Introduction for .NET developers
    Phalanger is a PHP language compiler for the .NET Framework which introduces PHP as a first-class .NET citizen.
Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
  (Refresh) 
-- There are no messages in this forum --

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 30 Sep 2005
Editor:
Copyright 2005 by Abishek Bellamkonda
Everything else Copyright © CodeProject, 1999-2009
Java | Advertise on the Code Project