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
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.
I found the solution after a long research. The issue was that when you run the app with 64 bit the IIS Express also needs to run as a 64 bit process (by default it is a 32 bit process) . To make it 64 bit there is an option in Visual Studio. Tools --> Options --> Projects and Solutions --> Web Projects --> Use the 64 bit version of IIS Express.
Voila and it works.
User contributions licensed under CC BY-SA 3.0