0

I have created a web project which uses sql compact but when I run this project, It gives me below error. enter image description here

An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

But When I check below option to run it with 64 bit version, It works fine. enter image description here However I have other .Net Websites(Not Projects) which run fine without these settings and they also consume same dlls. Perhaps I am missing a lot here.

LearningPal
  • 554
  • 2
  • 12
  • 27
  • Read related issues here: https://stackoverflow.com/questions/1648213/could-not-load-file-or-assembly-xxx-or-one-of-its-dependencies-an-attempt-was & https://stackoverflow.com/questions/2023766/an-attempt-was-made-to-load-a-program-with-an-incorrect-format-even-when-the-p. It depends on platform where IIS runs. – Tetsuya Yamamoto Jul 25 '17 at 08:40
  • 1
    Maybe this: http://erikej.blogspot.se/2013/12/the-trouble-with-any-cpuprefer-32.html – ErikEJ Jul 25 '17 at 09:12
  • I Have installed Sql compact 3.5 SP2...and I can not add sqlceme35.dll to references, It's a .Net 4.5 project in VS 2013. Also I assume "Prefer 32 bit unchecked" checkbox is not there in VS 2013. I need to run this project with "Any CPU" settings. Please suggest If I need to install anything else to have it worked. – LearningPal Jul 25 '17 at 10:21
  • @ErikEJ I have deployed SQL Server Compact 3.5 SP2 privately following your blog @ http://erikej.blogspot.dk/2012/05/private-deployment-of-sql-server.html but stil I get the same error. And I am clueless.. – LearningPal Jul 25 '17 at 10:59
  • 1
    I suggest you follow the simpler steps here; http://erikej.blogspot.se/2013/10/sql-server-compact-4-desktop-app-with.html and force your web app to 32 bit! – ErikEJ Jul 25 '17 at 14:39
  • Thanks a lot for you help – LearningPal Jul 27 '17 at 07:25

1 Answers1

1

Force your web app to 32 bit, and follow the simple deployment steps here: http://erikej.blogspot.se/2013/10/sql-server-compact-4-desktop-app-with.html

ErikEJ
  • 40,951
  • 5
  • 75
  • 115