visual-studio - WCF 64 位不起作用

标签 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 收到错误消息。

最佳答案

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

瞧,它的工作原理。

关于visual-studio - WCF 64 位不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3837746/

相关文章:

visual-studio - 是否存在为 .NET 类预编写单元测试的工具?

c# - 从 Web API 使用 HttpClient 发布 JsonObject

sharepoint - SP2013 SharePoint 托管的应用程序模式对话框错误 : Cannot read 'hiddenButtonValueBeforeDialog'

c# - Dynamics CRM 2011 实体

sharepoint - 更改 SharePoint 中的子网站 Logo URL

用于上传文件的 PHP 脚本在终端中有效,但不能像使用 incron 自动调用一样

c# - 视觉 C# : Cannot use the Convert method in winforms anymore

visual-studio - AnkhSvn 不向 SVN 添加文件

python - 带有 Visual C++ 编译器的 Cython?

wcf - 将 ASMX 转换为 WCF Web 服务