【发布时间】:2014-05-03 13:38:58
【问题描述】:
在将 MVC/EntityFramework 解决方案 (VS2012) 和实用程序解决方案从“任何 CPU”转换为“x64”后,我遇到了问题。我需要这样做,因为部署机器上只有 Oracle x64 驱动程序,并且由于某种原因这些驱动程序不会加载“任何 CPU”。
错误是:'无效的程序集平台或 ContentType'。
好的。 32/64 位不匹配某处。
我重新验证了所有项目都设置了“x64”。控制台应用程序项目(在实用程序解决方案中)都运行良好,并在任务管理器中显示为完全 64 位。这些控制台应用程序现在可以与 Oracle 64 位驱动程序对话,但它们没有在“任何 CPU”下。一切看起来都不错。
但是,当我现在使用 Visual Studio 开发服务器运行 MVC 项目时,它从实用程序解决方案获取的程序集 (utility1.dll) 现在因“程序集平台或 ContentType 无效”而失败。该程序集也被所有控制台应用程序成功使用。我使用 Fusion Log Viewer (fuslogvw.exe) 验证了错误:
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\user1\Documents\Visual Studio 2012\Projects\mvcWebSite\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/4446faac/e5108f09/utility1.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/4446faac/e5108f09/utility1/utility1.DLL.
LOG: Attempting download of new URL file:///C:/Users/user1/Documents/Visual Studio 2012/Projects/mvcWebSite/bin/utility1.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Users\user1\Documents\Visual Studio 2012\Projects\mvcWebSite\bin\utility1.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: utility1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
ERR: Invalid assembly platform or ContentType in file (hr = 0x8007000b).
ERR: Setup failed with hr = 0x8007000b.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
为什么它使用'C:\Windows\Microsoft.NET\Framework'而不是'C:\Windows\Microsoft.NET\Framework64'?部分问题?
所以我在 mvcWebSite bin 目录中运行了一个 arch 设置阅读器实用程序(其中应该包含网站的所有 DLL,这就是我所看到的):
这台机器是 64 位的
AntiXssLibrary.dll - I386 - ILOnly
Antlr3.Runtime.dll - I386 - ILOnly
utility1.dll - AMD64 - ILOnly, PE32Plus
utility2.dll - AMD64 - ILOnly, PE32Plus
EntityFramework.dll - I386 - ILOnly
HtmlSanitizationLibrary.dll - I386 - ILOnly
log4net.dll - I386 - ILOnly
Microsoft.Practices.Unity.Configuration.dll - I386 - ILOnly
Microsoft.Practices.Unity.dll - I386 - ILOnly
Microsoft.ReportViewer.Common.dll - I386 - ILOnly
Microsoft.ReportViewer.WebForms.dll - I386 - ILOnly
MvcReportViewer.dll - I386 - ILOnly
Newtonsoft.Json.dll - I386 - ILOnly
Oracle.DataAccess.dll - AMD64 - ILOnly, PE32Plus
RestSharp.dll - I386 - ILOnly
System.Web.Helpers.dll - I386 - ILOnly
System.Web.Http.dll - I386 - ILOnly
System.Web.Http.WebHost.dll - I386 - ILOnly
System.Web.Mvc.dll - I386 - ILOnly
System.Web.Optimization.dll - I386 - ILOnly
System.Web.Razor.dll - I386 - ILOnly
System.Web.WebPages.Deployment.dll - I386 - ILOnly
System.Web.WebPages.dll - I386 - ILOnly
System.Web.WebPages.Razor.dll - I386 - ILOnly
Unity.Mvc4.dll - I386 - ILOnly
mvcWebsite.dll - AMD64 - ILOnly, PE32Plus
这看起来好吗?我不知道为什么utility1不会加载。恐怕这里仍然存在“任何 CPU”设置的剩余部分。
感谢您的建议!
【问题讨论】:
-
你解决了这个问题吗?我对 asp.net web api 也有同样的情况。在我的本地机器上,我有 VS 2013 的 32 位 oracle 访问组件,一切正常。但是当我部署到只安装了64位oracle访问组件的服务器时,出现了错误。
标签: .net asp.net-mvc-4 visual-studio-2012 32bit-64bit