Reputation: 1005
I'm having problems after converting an MVC/EntityFramework solution (VS2012) and a utility solution from 'Any CPU' to 'x64'. I needed to do this because the deployment machine only had Oracle x64 drivers on it and these will not load with 'Any CPU' for some reason.
Error is: 'Invalid assembly platform or ContentType'.
Okay. 32/64 bit mismatch somewhere.
I re-verified all the projects have 'x64' set. Console app projects (in the utility solution) all run fine and show up in Task Manager as fully 64-bit. These console apps now talk to the Oracle 64-bit drivers okay where they didn't under 'Any CPU'. All looks good.
But when I now run the MVC project with the Visual Studio Development server, an assembly (utility1.dll) that it gets from the utility solution now fails with the 'Invalid assembly platform or ContentType'. This assembly is used successfully by all the console apps as well. I verified the error with the 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.
Why is it using 'C:\Windows\Microsoft.NET\Framework' and not 'C:\Windows\Microsoft.NET\Framework64'? Part of the problem?
So I ran an arch setting reader utility in the mvcWebSite bin directory (which should have all the DLL's in it for the website and this is what I see):
This machine is 64 bit
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
Does this look okay? I'm at a loss to figure out why utility1 will not load. I'm afraid that there's still a left-over from the 'Any CPU' setting that is still active here.
Thanks for any advice!
Upvotes: 1
Views: 1460
Reputation: 303
We can also switch IIS Express to 64-bit version under Options -> Projects and Solutions -> Web Projects
Upvotes: 1
Reputation: 1150
I've been having a similar issue with a third party library that is AMD64 while I'm using 'Any CPU'.
In the web.config's system.web section:
<compilation debug="true" targetFramework="4.5" >
<assemblies>
<remove assembly="The.Offending.Library.Name"/>
</assemblies>
</compilation>
My troubles have been intermittent and I'm not sure that this has actually resolved the issue but it seems to have. Hope it helps.
Upvotes: 0
Reputation: 1005
My problem was that the Visual Studio internal web server does not like 64-bit applications - hence it not liking the 64-bit assemblies. I switched to dpeloying to a local IIS server (in the project web settings).
I do know that if you are deploying to a remote IIS, you need to pay attention to the 'allow 32-bit apps' setting in the web application's assigned application pool.
Hopwe this helps.
Upvotes: 1