waleskim / linqtoexcel

Automatically exported from code.google.com/p/linqtoexcel
0 stars 0 forks source link

Could not load file or assembly 'LinqToExcel' or one of its dependencies when browse with IIS #40

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. build web application add linqtoexcel dll and all dependence dll
2. build and run via visual studio work well
3. publish to IIS try to browse website got error

What is the expected output? What do you see instead?
linqtoexcel cannot work with web application? 

What version of the product are you using? On what operating system?
1.52

Please provide any additional information below.

Could not load file or assembly 'LinqToExcel' or one of its dependencies. An 
attempt was made to load a program with an incorrect format.

Stack Trace: 

[BadImageFormatException: Could not load file or assembly 'LinqToExcel' or one 
of its dependencies. An attempt was made to load a program with an incorrect 
format.]
   System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
   System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +416
   System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +166
   System.Reflection.Assembly.Load(String assemblyString) +35
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +190

[ConfigurationErrorsException: Could not load file or assembly 'LinqToExcel' or 
one of its dependencies. An attempt was made to load a program with an 
incorrect format.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11207304
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +388
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +232
   System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +48
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +210
   System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +76
   System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +11196482
   System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +185
   System.Web.Compilation.BuildManager.CompileCodeDirectories() +654
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +658

[HttpException (0x80004005): Could not load file or assembly 'LinqToExcel' or 
one of its dependencies. An attempt was made to load a program with an 
incorrect format.]
   System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +76
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +1012
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +1025

[HttpException (0x80004005): Could not load file or assembly 'LinqToExcel' or 
one of its dependencies. An attempt was made to load a program with an 
incorrect format.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11301302
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4338644

Original issue reported on code.google.com by shenxu...@gmail.com on 7 May 2011 at 8:20

GoogleCodeExporter commented 9 years ago
This is probably caused by IIS on your server running the application in 64 bit 
mode. LinqToExcel requires 32 bit mode enabled. Here is a link showing how to 
enable the app pool to run 32 bit applications. 
http://blogs.msdn.com/b/rakkimk/archive/2007/11/03/iis7-running-32-bit-and-64-bi
t-asp-net-versions-at-the-same-time-on-different-worker-processes.aspx 

Let me know if that fixes your issue.

Original comment by paulyo...@gmail.com on 9 May 2011 at 6:52

GoogleCodeExporter commented 9 years ago
Thank for help, solve the problem.

Original comment by shenxu...@gmail.com on 13 May 2011 at 11:31

GoogleCodeExporter commented 9 years ago

Original comment by paulyo...@gmail.com on 13 May 2011 at 1:06

GoogleCodeExporter commented 9 years ago
Is it possible to make a version which uses just the ACE and not the JET? I 
cannot switch IIS6 to 32 bit and I get this error on application start.

Original comment by daniel.k...@gmail.com on 1 Jul 2011 at 10:53

GoogleCodeExporter commented 9 years ago
You should be able to run 32 bit app on IIS 6. Just follow these instructions: 
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/13f99
1a5-45eb-496c-8618-2179c3753bb0.mspx?mfr=true

Original comment by paulyo...@gmail.com on 1 Jul 2011 at 1:19

GoogleCodeExporter commented 9 years ago
We tried to modify your source code to reference just ACE and it's working for 
xls also. No reason to support the old JET providers. :)

Original comment by daniel.k...@gmail.com on 2 Jul 2011 at 5:36

GoogleCodeExporter commented 9 years ago
great to hear you got it working!

Original comment by paulyo...@gmail.com on 2 Jul 2011 at 5:06

GoogleCodeExporter commented 9 years ago
Could you pass on the code to get it to work on a 64bit OS?

Original comment by jonathan...@gmail.com on 12 Oct 2011 at 8:19

GoogleCodeExporter commented 9 years ago
this article explains how: 
http://blogs.msdn.com/b/rakkimk/archive/2007/11/03/iis7-running-32-bit-and-64-bi
t-asp-net-versions-at-the-same-time-on-different-worker-processes.aspx

Original comment by paulyo...@gmail.com on 12 Oct 2011 at 9:26

GoogleCodeExporter commented 9 years ago
Unfortunately I cannot enable 32 bit mode as I have other dependencies that 
will only run in 64bit mode. I was hoping compiling LinqToExcel in 64bit mode 
would work but after I did that I got another error about its dependencies 
possibly complied against x86. You can see the exact error at 
www.tbmaster.co.uk  This currently has LinqToExcel compiled as 64 bit

Original comment by jonathan...@gmail.com on 12 Oct 2011 at 9:31

GoogleCodeExporter commented 9 years ago
Double checked and it wasnt compiled as 64 bit. Now it is and its importing 
*.xlsx files perfectly. I assume it wont if its just xls or csv??

Original comment by jonathan...@gmail.com on 12 Oct 2011 at 9:39

GoogleCodeExporter commented 9 years ago
Jonathan, I'm trying to get LinqToExcel to work in 64bit mode like you did. Did 
you make any code changes or did you just compile it in 64bit?

Original comment by paulyo...@gmail.com on 21 Oct 2011 at 9:07

GoogleCodeExporter commented 9 years ago
You will need to compile the source code down to a set of 64-bit assemblies. 
Additionally, you will most likely need to install a 64-bit Jet Engine. If you 
go to http://www.microsoft.com/download/en/details.aspx?id=13255 you can 
pick-up the 64-bit Access redistributable which will get you the 64-bit Jet.

Hope this helps.

Original comment by nielsen....@gmail.com on 4 Dec 2011 at 5:35

GoogleCodeExporter commented 9 years ago
Anyone get the 64-bit version working?

Doing "cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 1" 
("true" does not work) is not fixing the issue.  

Thanks.

Original comment by Goog...@gmail.com on 5 Dec 2011 at 8:59

GoogleCodeExporter commented 9 years ago
There is now a 64 bit version of LinqToExcel available. You can download it 
from NuGet or from the downloads page.

You will need to make sure to have the 64 bit version of the Access Database 
Engine installed on the computer as well.

Original comment by paulyo...@gmail.com on 30 Dec 2011 at 1:26

GoogleCodeExporter commented 9 years ago
May I ask where is the 64 bit version on LinqToExcel NuGet package?

Original comment by doggy.hu...@gmail.com on 10 May 2014 at 5:21

GoogleCodeExporter commented 9 years ago
Sorry, I was found the x64 version of LinqToExcel is over here:
https://www.nuget.org/packages/LinqToExcel_x64/

Original comment by doggy.hu...@gmail.com on 10 May 2014 at 6:36