The problem is that you need to install the Crystal Reports runtime. This isn't a problem with regular hosting since you can just install Crystal Reports on each of your servers and off you go.
With Azure, though, if you remote into the machine and install it, it will work fine until your deployment is redistributed to another machine which it will do at some point due to the nature of cloud computing.
How to install Crystal Reports on your Azure web role
Fortunately it is still easy with Azure. Easy when you know how anyway. Here are the steps you will need to take:
First of all you will need to download the SAP Crystal Reports runtime engine for .NET Framework 4 (64-bit). This should extract as a msi file called CRRuntime_64bit_13_0_2.msi.
In your web application in Visual Studio you should paste this msi file at the route of your web project and include it in the project. Right click it in the Solution Explorer and set its 'Build Action' to 'None' and also set its 'Copy to Output Directory' to 'Always Copy'.
Next you will create a command file to execute this msi file. Create a new text file, call it StartUp.cmd and then save it in the root of your web project (next to the msi). In that file write the following:
@ECHO off ECHO "Starting CrystalReports Installation" >> log.txt msiexec.exe /I "CRRuntime_64bit_13_0_2.msi" /qn ECHO "Completed CrystalReports Installation" >> log.txt
Set the properties of StartUp.cmd to 'Build Action' = 'None' and 'Copy to Output Directory' = 'Always Copy'.
Now in your ServiceDefinition.csdef make this cmd file a start up task by adding the following lines:
<WebRole name="Web" vmsize="Small"> ... <Startup> <Task commandLine="StartUp.cmd" executionContext="elevated" taskType="background" /> </Startup> </WebRole>
You are now instructing each instance that starts up with your package to run the Crystal Reports msi file that installs the runtime on the instance ready for its use in Azure.
A few Crystal Reports on Azure tips
I ran into a few bits and bobs which caused me unnecessary pain along the seemingly clean process outlined above. I will share them with you in case you do too in no particular order.
- Make sure your .rpt Crystal Report files are set to Build Action: Content and Copy to Output Directory: Copy always.
- Don't be alarmed with how long it takes to deploy. It will take much longer to upload than usual because you are now uploading an extra 77MB of installation files. It took me an hour to deploy on my home connection!
- Ignore all the warnings about how your web project is dependent on various Crystal Report assemblies since Azure will have them just as soon as your installation file runs.
- Configure a remote desktop connection when you do your deployments since it will be invaluable should anything go wrong and at an hour per deployment you don't want to be messing about.
- Visual Studio may have added a load of random assemblies in your web.config you are not aware of and don't need and may even cause problems like log4net.
That is all. Good luck - it's very satisfying when you get it going.
I followed this along with partial success, but that's probably a version thing [it's now May 2012].
ReplyDeleteMy Azure webrole is on an x64 server, and I'm developing in vs2010, with .Net 4.0. Crystal runtime is up to 13.0.3.
The big issue is the 'undefined bobj' error, which I think is being caused because IIS is installed on D: on the Azure server. Does Crystal look for the viewer on C:?
My work around, if it helps, was found here http://social.msdn.microsoft.com/Forums/en-CA/vscrystalreports/thread/ef56f72b-7ede-47d8-ba9e-9e63b9ac0203.
Bascially copy all the viewer files from the aspnet_client\system_web\4_0_30319 to a sub-directory of your project, fill in the sections in your web.config as shown in the link above, and it works.
Great instruction, all works. But I have one problem: I have a report with dynamic parameter and from local computer I have a list of items from combo box. But when I upload it to Azure and I view report, I have to enter value to textbox (like in static parameter).
ReplyDeleteI connect to Azure database.
Nice article, and I have implemented the same as you posted, but i am unable to publish to Azure.
ReplyDeleteI am getting the below error when I click on Publish
Error 64 Exception of type 'System.OutOfMemoryException' was thrown. C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Windows Azure Tools\1.7\Microsoft.WindowsAzure.targets 2814 5 WindowsAzure1
Can you help on this?
this way is good one to install crystall reports but it akes too much time .
ReplyDeletealternatively we can use .bat file and powershell to run crystal reports on azure
it is very fast ,whole procedure is finished in 20 minutes.
Hi!!
ReplyDeleteCan you show me the way to do it with a .bt and powershell?
May be it's posible to host the engine into a Blob and create an Script to download it and install it, but I don't know how.
Hi, I uploaded to Windows Azure a WebSite that uses Crystal Reports.
ReplyDeleteI'm not using a Virtual Machine, but a "Standard Web Site". Is this tutorial specific for virtual Machine? If it isn't, where "ServiceDefinition.csdef" comes from??
Regads.
Dear Jaime,
DeleteDid you get any solutions to this? I am stuck with the same scenario.
Hi Usman,
DeleteSorry for the delay.
I endup using a cloud service following those steps.
"ServiceDefinition.csdef" comes from the Azure project you have to include to your solution.
Hope this helps.
Cheers.
OK thanks, i will look into it and will try to implement.
Deletehttps://stackoverflow.com/questions/36769894/creating-a-servicedefinition-csdef
DeleteHi Colin, I moved to Cloud Servive and followed your steps, but it crash with log4net.dll: “Could not load file or assembly ‘log4net’ or one of its dependencies.”, and log4net is not included in my web.config.
ReplyDeleteDid you face this problem?
Thanks
Hi Colin,
ReplyDeleteWe have deployed crystal reports on azure web roles. We are facing following issues:
1. We have noticed that whenever the web roles cloud service restarts(for any unknown reason), the crystal reports installation doesn’t work and the cloud service just goes into loop of starting and restarting, and our web application doesn’t work at all. The error we get is: : Could not load file or assembly 'CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The way we fix this problem is by logging remotely into the instance and manually installing crystal reports. After that our web application works fine.
2. The biggest advantage of web roles is that we can have multiple instances. But we have noticed that the moment we have more than one instance, sometimes crystal reports work and sometimes it doesn’t. What happens is sometimes when it doesn’t work we see cross image indicating image not found. But if we have only one instance then no problems, crystal reports works fine. But then we cannot take full advantage of azure web roles multiple instances capability.
Any help/suggestion much appreciated
I have spent complete 2 days and now almost fedup. Is this solution not valid for asp.net mvc web app which is currently working fine on Azure. I added one view which is returning pdf version of crystal report. I am unable to run. Can run startup.cmd file. As i can only use webjobs. Is there any way i can run .msi file in my web app on Azure? Your help will be highly appriciated. Thanks
ReplyDeleteDid you get a solution? We are trying to run a MVC Project and we have the issue on create a ReportDocument(), the error is "log2net.dll could not be loaded".
DeleteI did not get log2net.dll related error. On Azure, i was having issue with crystal reports. I am still struggling with it. Just got one answer today (see above comments) will try to implement that solutions. If it works, will share with you.
DeleteHi Usman, if your using free trial version in window Azure then your not able to installmsiexec.exe /I "CRRuntime_64bit_13_0_2.msi" /qn but if your paid version then once you install msiexec.exe then you won't get Error, you can able to view report.
ReplyDeleteHi
ReplyDeleteI am getting logon failed, however I can connect to SQL server through SSMS , and the rest of ASP.net site.
Any ideas
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteAfter deployed in azure, we get this error :
ReplyDeleteSystem.TypeInitializationException: The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception. ---> System.TypeInitializationException: The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
at CrystalDecisions.Shared.SharedUtils..cctor()
--- End of inner exception stack trace ---
at CrystalDecisions.Shared.SharedUtils.get_CurrentControl()
at CrystalDecisions.Shared.SharedUtils.GetEffectiveCulture()
at CrystalDecisions.CrystalReports.Engine.CREngineRes.GetString(String name)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.CheckForCrystalReportsRuntime()
at CrystalDecisions.CrystalReports.Engine.ReportDocument..cctor()
--- End of inner exception stack trace ---
at CrystalDecisions.CrystalReports.Engine.ReportDocument..ctor()
at AzureCrystal.Controllers.HomeController.PrintReport()
Ok the issue was the 64 bit. I had to use the 32 bit to get rid of the log4net error
ReplyDeletehi, ?I am getting the following error after sometime..
ReplyDeleteThe HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Bearer error="invalid_token", error_description="A security token validation error occured for the received JWT token."'.
hii. i want to use crystal report in app services in azure then how to use
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteclash royale
ReplyDeleteWholesale printed custom perfume boxes with the highest quality and affordable prices. Free worldwide Delivery and free Custom Perfume Boxes design.
ReplyDeleteBuy online wholesale custom eyeshadow palette packaging and packaging at seashore packaging at the easy price Free shipping worldwide with 24/7 customer support.
ReplyDeleteBlackbird packaging provide you with any size, shape design, cbd boxes sooner than any other packaging competitor in the market
ReplyDeletePacakaging town is a one stop solution for the short-run cbd facial oil boxes needs and supplies. At affordable prices. Request a free quote now.
ReplyDeletePackaging town is a one stop solution for the short-run interlock boxes Wholesale Custom Boxes needs and supplies. At affordable prices. Request a free quote now.
ReplyDeleteBlackbird packaging provide you with any size, shape design, cbd bath bomb wholesale sooner than any other packaging competitor in the market
ReplyDeletebuy lahore grocery online from alfatah at best prices. Get free shipping.
ReplyDeletebuy grocery online from alfatah at best prices. Get free shipping
ReplyDeletebuy men zipper hoodies from wild goat clothing at best pricces. Get Free shipping
ReplyDeletebuy men zipper hoodie online from wild goat clothing at best prices. Get free shipping.
ReplyDeletePackaging town is a one stop solution for the short-run custom pillow boxes needs and supplies. At affordable prices. Request a free quote now.
ReplyDeleteBuy home appliances online from Al-Fatah at best prices. Get free shipping
ReplyDeleteBuy cat food online from Al-Fatah at best prices. Get free shipping
ReplyDeletePackaging town is a one stop solution for the short-run tuck top mailers needs and supplies. At affordable prices. Request a free quote now.
ReplyDeletebuy dental care products online from medisense at easy prices delivered at your doorstep. get free shipping
ReplyDeletebuy mens gym bottoms online from dshred at easy prices delivered at your doorstep. Get free shipping
ReplyDeleteBuy gym wear online pakistan from dshred at easy prices delivered at your doorstep. get free shipping
ReplyDeletebuy men tanks top online from dshred at best prices delivered at your doorstep. Get free shipping
ReplyDeleteReady for the perfect job but can't decide what to wear? Get our men tracksuits specifically designed to get the job done. We have the best manufacturing ability of tracksuits in Pakistan. Our men's tracksuits come in great handy for workouts and also lounging around.w
ReplyDeleteBuy online tshirts from ndure at best prices delivered at your doorstep. Get free shipping
ReplyDeleteBuy air cooler from Al-Fatah at best prices delivered at your doorstep. Get free shipping
ReplyDeletebuy Grocery online Pakistan from Al-Fatah at best prices delivered at your doorstep. Get free shipping.
ReplyDeleteThis comment has been removed by the author.
ReplyDeletenice post and article, best collection, will be thankful if you can share collection of websites which offers peshawari chappal. thanks..
ReplyDeleteBest friend rings are the perfect way to show your best friend how much you care. Whether you’re celebrating a special occasion or just because these rings are a beautiful reminder of your friendship.
ReplyDeleteKroatien hat sich zu einem aufstrebenden Ziel für IT-Nearshoring entwickelt. Das Land bietet eine Kombination aus qualifizierten IT-Fachkräften, kultureller Nähe zu Westeuropa und einer stabilen politischen und wirtschaftlichen Umgebung. Unternehmen, die ihre IT-Projekte nach Kroatien auslagern, profitieren von einer hohen Qualität der Dienstleistungen, einer schnellen Markteinführung und kosteneffizienten Lösungen. Die kroatische Regierung hat auch verschiedene Initiativen zur Förderung des IT-Sektors ergriffen, um ein positives Geschäftsumfeld zu schaffen. Mit Kroatien als IT-Nearshoring-Partner können Unternehmen ihre Effizienz steigern und gleichzeitig ihre Kosten senken. Diese Seite
ReplyDelete