{"id":3668,"date":"2014-03-29T07:45:59","date_gmt":"2014-03-29T07:45:59","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/could-not-load-file-or-assembly-oracle-dataaccess-collection-of-common-programming-errors\/"},"modified":"2014-03-29T07:45:59","modified_gmt":"2014-03-29T07:45:59","slug":"could-not-load-file-or-assembly-oracle-dataaccess-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/could-not-load-file-or-assembly-oracle-dataaccess-collection-of-common-programming-errors\/","title":{"rendered":"Could not load file or assembly &#39;Oracle.DataAccess&#39;-Collection of common programming errors"},"content":{"rendered":"<p>I have a Windows Server 2008 x64 machine and have successfully connected a simple ASP.NET\/C# application to an Oracle database using the ODAC 11g client. My next step, is adding this same oracle connection to a SharePoint web part (which is developed on the same machine). The SharePoint Server, Web Server, etc. all live on the same machine as well. I figured I could just add the Oracle.DataAccess reference to my SharePoint Web Part, add the oracle connection code, and be done&#8230; but ohh now&#8230; I am getting the following error when loading my web part through the browser with the oracle connection:<\/p>\n<p>[BadImageFormatException: Could not load file or assembly &#8216;Oracle.DataAccess, Version=2.112.1.1, Culture=neutral, PublicKeyToken=89b483f429c47342&#8217; or one of its dependencies. An attempt was made to load a program with an incorrect format.]<\/p>\n<p>Can someone please help me debug this? I have the assembly in the GAC with the correct version. For some reason it is not seeing it? I am confused as to why a simple ASP.NET\/C# application would work fine, but now that it is up on SharePoint it does not work. Any ideas?<\/p>\n<p>SPECFIC ERROR:<\/p>\n<p>[TargetInvocationException: Exception has been thrown by the target of an invocation.] at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandle&amp; ctor, Boolean&amp; bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at Microsoft.SharePoint.WebPartPages.SPWebPartReflectionHelper.GetDefaultControl(Type controlType) at Microsoft.SharePoint.WebPartPages.BinaryWebPartDeserializer.LoadInitialWebPart() at Microsoft.SharePoint.WebPartPages.BinaryWebPartDeserializer.Deserialize() at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)<\/p>\n<p>[BadImageFormatException: Could not load file or assembly &#8216;Oracle.DataAccess, Version=2.112.1.1, Culture=neutral, PublicKeyToken=89b483f429c47342&#8217; or one of its dependencies. An attempt was made to load a program with an incorrect format.] at PortalOBIEEReportList.OBIEEReportList.OBIEEReportList..ctor()<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a Windows Server 2008 x64 machine and have successfully connected a simple ASP.NET\/C# application to an Oracle database using the ODAC 11g client. My next step, is adding this same oracle connection to a SharePoint web part (which is developed on the same machine). The SharePoint Server, Web Server, etc. all live on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3668","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3668","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3668"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3668\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}