Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi..
 
I am currently working with one of the asp.net website(4.0 framework) where am using crytal reports,which is working fine only in localhost not on server after hosting.
 
Can anyone please let me know wat might be the issue??
Posted 7-Jul-12 1:14am
Comments
Sandeep Mewara at 7-Jul-12 14:19pm
   
You need to elaborate more on: "working fine only in localhost not on server after hosting"
bhagyap at 9-Jul-12 4:14am
   
My website is working locally but not on remote server,it gives me following exception:-
 
Error System.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.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at CrystalDecisions.Shared.SharedUtils..cctor() --- End of inner exception stack trace --- at CrystalDecisions.Shared.SharedUtils.GetClientCulture() 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()
 
can you please help me?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

See Below Link You may get some idea
http://www.manjuke.com/2009/07/type-initializer-for-threw-exception.html[^]
 
and about the exception
 
First things to check are:
 
1) Architecture (x86, x64)
2)Crystal Runtime Version
 

 
TypeInitializationException occurs when a static constructor has an error. It is thrown from static constructors. It actually wraps the errors from static constructors. It cannot be trapped outside of the static constructor reliably.
The Below Program Shows How this error will come
 
using System;
 
class Program
{
    static Program()
    {
	//
	// Static constructor for the program class.
	// ... Also called a type initializer.
	// ... It throws an exception in runtime.
	//
	int number = 100;
	int denominator = int.Parse("0");
	int result = number / denominator;
	Console.WriteLine(result);
    }
 
    static void Main()
    {
	// Entry point.
    }
}
 
Output
 
Unhandled Exception: System.TypeInitializationException: The type initializer for
'Program' threw an exception. --->
System.DivideByZeroException: Attempted to divide by zero.
   at Program..cctor() in....
   --- End of inner exception stack trace ---
   at Program.Main()
 
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

System.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference
Above error simply means: You are using Log4Net to log errors which is missing on the server.
 
Make sure that the log4Net.dll is present on server. Version of assembly should be same as referenced in your project. Even assembly version mismatch will raise error here.
Either install it or put the dll in bin folder of your application.
  Permalink  
Comments
bhagyap at 9-Jul-12 5:07am
   
thanks for ur reply.. the dll is already present on server and still my reports aren't working.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 9 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100