WCF 64 位不工作 [英] WCF 64 bit not working

查看:19
本文介绍了WCF 64 位不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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

一旦我更改了项目的属性以使其在 64 位中编译,运行它会引发以下异常:

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:	empWcfService2WcfService2in
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: d:	empWcfService2WcfService2web.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFrameworkv4.0.30319configmachine.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

WCF确实在将平台目标设置为 AnyCPU 后编译,但我需要专门设置 64 位编译,因为我正在使用 SharePoint 对象和 AnyCPU(或 x86)编译结果此处 (以及网络上的其他地方).

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

因此,要么我编译 AnyCPU/x86 并从与 SharePoint 的集成中收到错误消息,要么将目标平台设置为 64 位并从 WCF 收到错误消息.

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.

推荐答案

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

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.

瞧,它的工作原理.

这篇关于WCF 64 位不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆