Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio WCF 64位不工作_Visual Studio_Wcf_Sharepoint_64 Bit - Fatal编程技术网

Visual studio WCF 64位不工作

Visual studio WCF 64位不工作,visual-studio,wcf,sharepoint,64-bit,Visual Studio,Wcf,Sharepoint,64 Bit,我正在尝试开发一个在64位环境中运行的简单WCF服务。 我在Windows7下启动VS2010 新解决方案->WCF项目->运行->工作正常 当我更改项目的属性以使其以64位编译时,运行它会引发以下异常: Could not load file or assembly 'WcfService2' or one of its dependencies. 使用以下程序集加载跟踪 === Pre-bind state information === LOG: User = ***** LOG: Di

我正在尝试开发一个在64位环境中运行的简单WCF服务。 我在Windows7下启动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.
我怎样才能克服这个问题?有什么想法吗?谢谢

编辑:

WCF在将平台目标设置为AnyCPU后确实会编译,但我需要专门设置64位编译,因为我正在使用SharePoint对象,AnyCPU(或x86)编译会导致与所描述的问题和错误完全相同的问题和错误(以及在网络上的其他地方)


因此,要么编译AnyCPU/x86,与SharePoint集成时出错,要么将目标平台设置为64位,然后从WCF中出错。

您的WcfService2程序集是否标记为平台目标==x86?您应该尝试确保它被编译到任何CPU。您可以在Visual Studio项目设置的生成页面中找到此设置。

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

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


瞧,它成功了。

您好,谢谢您的评论,但这仍然不能解决问题,正如我在上面的编辑部分所述。您收到的错误代码意味着“试图加载格式不正确的程序。”。对我来说,这表明您可能依赖的库不是x64,而这正是造成问题的原因。您确定所有引用都是任何CPU或x64吗?您是否曾经让服务在64位下运行?我也有同样的问题,你解决了这个问题吗?请让我知道