3

I see the following error in Visual Studio for both Web Sites and Web Applications in Visual Studio for a .NET (presentation) website, on a Windows Server 2008 R2, 64-bit.

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

I don't get an error when viewing the site outside of the IDE (with site setup in IIS and visited with a browser).

My colleagues explained this is related to using Visual Studio's built-in web server (Cassini), which I understand conflicts with the 64-bit Tridion.ContentDelivery.AmbientData.dll.

  1. What are appropriate ways to manage this error to develop .NET sites with SDL Tridion's Content Delivery API?
  2. Any difference between what I should do if working with a Web Application versus Web Site?

I notice setting Property Pages > Build to No Build removes the error and still allows debugging, but am not sure if I'm missing something by doing this.

craig65535
  • 3,439
  • 1
  • 23
  • 49
Alvin Reyes
  • 2,889
  • 16
  • 38

3 Answers3

4

Cassini doesn't support 64-bit out-of-the-box, but you can apparently get a version that does.

See the following topic right here on StackOverflow: Is Visual Studio 2010 WebDev WebServer (Cassini) 64-bit compatible?

Community
  • 1
  • 1
Peter Kjaer
  • 4,316
  • 13
  • 23
  • +1 for the option to use a different development server. I installed [CassiniDev](http://cassinidev.codeplex.com/) on my VM. Still getting the error for now--I'll try a bit more and report back. – Alvin Reyes Aug 04 '12 at 21:31
  • I ended up using CassiniDev for my own development, but IIS on development boxes I don't own (training and internal development). – Alvin Reyes Jan 30 '13 at 05:36
3

If you want to be able to debug from VS, the only reliable way I found is to configure the site to run in 32 bits.

Otherwise, setting a breakpoint and attaching to W3WP works fine.

N

Nuno Linhares
  • 10,214
  • 1
  • 22
  • 42
  • 2
    You can also configure VS to use IIS for debugging. Just create a site on your local host, use a 64-bit app pool, and configure your project (on the web tab) to use a local IIS server. VS will take care of attaching the process for you. – Quirijn Aug 03 '12 at 13:52
  • +1 to Quirijn's comment. I found the (MSDN article)[http://msdn.microsoft.com/en-us/library/ms178108.aspx] on such a setup for `Web application projects` in Visual Studio. "Web *Sites*" have IIS Express as an option. – Alvin Reyes Aug 04 '12 at 15:07
  • I'm closer. Attaching to w3wp (or WebDev.WebServer40.EXE with CassiniDev with ASP.NET 4.0) does get the breakpoint to trigger. But I still get the error (but now in the browser). To make it "run in 32 bits" -- is that just using the 32-bit dlls, or is there a setting in Visual Studio? – Alvin Reyes Aug 04 '12 at 21:38
  • 1
    If you are getting the error in the browser, then the DLLs in your bin folder are not the same format as your Application Pool uses. That's not related to debugging, though. – Peter Kjaer Aug 06 '12 at 09:07
0

In some cases, for each application runs creates a temp directory, where application dlls are put by VS, it always has unique name. Maybe it's not tour case, but you can try to put this dll in GAC first. To exclude this case

ASpirin
  • 3,601
  • 1
  • 23
  • 32