views:

57

answers:

1

Hi,

I'm trying to develop a simple WCF service running in a 64 bit environment. I fire up VS2010 under Windows 7

New Solution -> WCF project -> Run -> It works fine.

As soon as I change the properties of the project in order to make it compile in 64 bit, running it throws the following exception:

Could not load file or assembly 'WcfService2' or one of its dependencies.

With the following Assembly Load Trace

=== Pre-bind state information ===
LOG: User = *****
LOG: DisplayName = WcfService2
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: WcfService2 | Domain ID: 4
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///d:/temp/WcfService2/WcfService2/
LOG: Initial PrivatePath = d:\temp\WcfService2\WcfService2\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: d:\temp\WcfService2\WcfService2\web.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL     file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/806f4cb8/df40e9e2/WcfService2.DLL.
LOG: Attempting download of new URL     file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/806f4cb8/df40e9e2/WcfService2/WcfService2.DLL.
LOG: Attempting download of new URL     file:///d:/temp/WcfService2/WcfService2/bin/WcfService2.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

How can I overcome the problem? Any idea? Thanks

EDIT:

The WCF does compile after setting the Platform Target to AnyCPU, but I need to specifically set a 64 bit compilation because I'm working with SharePoint objects and a AnyCPU (or x86) compilation results in the very same problem and error described here (and in other places on the net).

So either I compile AnyCPU/x86 and I get an error from the integration with SharePoint or I set the target platform to 64 bit and I get an error from WCF.

+1  A: 

Is your WcfService2 assembly marked with Platform Target == x86? You should try ensuring that it is compiled to Any CPU instead. You'll find this setting in the Build page of the Visual Studio project settings.

tomasr
hi, thanks for you comment, but this still doesn't solve the problem as i described in the EDIT section above
pistacchio
The error code you're getting means this "An attempt was made to load a program with an incorrect format.". This suggests, to me, that you're probably depending on a library that is not x64, and that is causing the trouble. Are you sure all your references are either ANY CPU or x64?
tomasr