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
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.
Thank for help, solve the problem.
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.)
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.
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
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. :)
great to hear you got it working!
Could you pass on the code to get it to work on a 64bit OS?
this article explains how:
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
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
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??
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?
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.
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.
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.