WCF 64位无法正常工作

时间:2010-10-01 08:59:06

标签: visual-studio wcf sharepoint 64-bit

我正在尝试开发一个在64位环境中运行的简单WCF服务。 我在Windows 7下启动VS2010

新解决方案 - > WCF项目 - >运行 - >它工作正常。

只要我更改项目的属性以使其以64位进行编译,运行它会引发以下异常:

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

使用以下装配加载跟踪

=== 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.

我该如何克服这个问题?任何的想法?感谢

修改

将平台目标设置为AnyCPU后,WCF 进行编译,但我需要专门设置64位编译,因为我正在使用SharePoint对象和AnyCPU(或x86)编译结果同样的问题和错误描述here(以及在网上的其他地方)。

因此,我编译AnyCPU / x86并从SharePoint集成中收到错误,或者我将目标平台设置为64位,我从WCF收到错误。

3 个答案:

答案 0 :(得分:2)

您的WcfService2程序集是否标有Platform Target == x86?您应该尝试确保将其编译为任何CPU。您可以在Visual Studio项目设置的“构建”页面中找到此设置。

答案 1 :(得分:2)

浏览到应用程序池的高级设置。 将“启用32位应用程序”设置为true

答案 2 :(得分:1)

经过长时间的研究,我找到了解决方案。问题是,当您使用64位运行应用程序时,IIS Express还需要作为64位进程运行(默认情况下,它是32位进程)。要使其成为64位,Visual Studio中提供了一个选项。 工具->选项->项目和解决方案-> Web项目->使用IIS Express的64位版本。

Voila,它起作用。