Issue 40 in linqtoexcel: Could not load file or assembly 'LinqToExcel' or one of its dependencies when browse with IIS

1,770 views
Skip to first unread message

linqt...@googlecode.com

unread,
May 7, 2011, 4:21:00 AM5/7/11
to linqt...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 40 by shenxu...@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

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


linqt...@googlecode.com

unread,
May 9, 2011, 2:52:40 PM5/9/11
to linqt...@googlegroups.com

Comment #1 on issue 40 by paulyo...@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

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-bit-asp-net-versions-at-the-same-time-on-different-worker-processes.aspx

Let me know if that fixes your issue.

linqt...@googlecode.com

unread,
May 13, 2011, 7:32:36 AM5/13/11
to linqt...@googlegroups.com

Comment #2 on issue 40 by shenxu...@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

Thank for help, solve the problem.

linqt...@googlecode.com

unread,
May 13, 2011, 9:07:22 AM5/13/11
to linqt...@googlegroups.com
Updates:
Status: Fixed

Comment #3 on issue 40 by paulyo...@gmail.com: Could not load file or

assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

(No comment was entered for this change.)

linqt...@googlecode.com

unread,
Jul 1, 2011, 6:54:19 AM7/1/11
to linqt...@googlegroups.com

Comment #4 on issue 40 by daniel.k...@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

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.

linqt...@googlecode.com

unread,
Jul 1, 2011, 9:20:17 AM7/1/11
to linqt...@googlegroups.com

Comment #5 on issue 40 by paulyo...@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

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/13f991a5-45eb-496c-8618-2179c3753bb0.mspx?mfr=true

linqt...@googlecode.com

unread,
Jul 2, 2011, 1:37:10 AM7/2/11
to linqt...@googlegroups.com

Comment #6 on issue 40 by daniel.k...@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

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. :)

linqt...@googlecode.com

unread,
Jul 2, 2011, 1:06:35 PM7/2/11
to linqt...@googlegroups.com

Comment #7 on issue 40 by paulyo...@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

great to hear you got it working!

linqt...@googlecode.com

unread,
Oct 12, 2011, 4:19:58 PM10/12/11
to linqt...@googlegroups.com

Comment #8 on issue 40 by jonathan...@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

Could you pass on the code to get it to work on a 64bit OS?

linqt...@googlecode.com

unread,
Oct 12, 2011, 5:27:01 PM10/12/11
to linqt...@googlegroups.com

linqt...@googlecode.com

unread,
Oct 12, 2011, 5:32:11 PM10/12/11
to linqt...@googlegroups.com

Comment #10 on issue 40 by jonathan...@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

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

linqt...@googlecode.com

unread,
Oct 12, 2011, 5:39:28 PM10/12/11
to linqt...@googlegroups.com

Comment #11 on issue 40 by jonathan...@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

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??

linqt...@googlecode.com

unread,
Oct 21, 2011, 5:08:20 PM10/21/11
to linqt...@googlegroups.com

Comment #12 on issue 40 by paulyo...@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

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?

linqt...@googlecode.com

unread,
Dec 4, 2011, 12:36:50 AM12/4/11
to linqt...@googlegroups.com

Comment #13 on issue 40 by nielsen....@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

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.

linqt...@googlecode.com

unread,
Dec 5, 2011, 4:00:25 PM12/5/11
to linqt...@googlegroups.com

Comment #14 on issue 40 by Goog...@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

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.

linqt...@googlecode.com

unread,
Dec 29, 2011, 8:26:58 PM12/29/11
to linqt...@googlegroups.com

Comment #15 on issue 40 by paulyo...@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

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.

linqt...@googlecode.com

unread,
May 10, 2014, 1:21:21 PM5/10/14
to linqt...@googlegroups.com

Comment #16 on issue 40 by doggy.hu...@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

May I ask where is the 64 bit version on LinqToExcel NuGet package?

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

linqt...@googlecode.com

unread,
May 10, 2014, 2:36:42 PM5/10/14
to linqt...@googlegroups.com

Comment #17 on issue 40 by doggy.hu...@gmail.com: Could not load file or
assembly 'LinqToExcel' or one of its dependencies when browse with IIS
http://code.google.com/p/linqtoexcel/issues/detail?id=40

Sorry, I was found the x64 version of LinqToExcel is over here:
https://www.nuget.org/packages/LinqToExcel_x64/
Reply all
Reply to author
Forward
0 new messages