I recently came across this error on my Sitecore site after I installed and uninstalled Sitecore.Ship:
Could not load file or assembly 'Oracle.DataAccess, Version=18.104.22.168, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified. WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
I’d like to share here how I fixed this error and my debugging process. The first thing I did was to enable assembly binding logging to get more information. To do this: type in Regedit in your Start search bar and open Registry Editor. On the left panel navigate to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion, right click on the empty space on the right side and click New > DWORD(32-bit) Value. Make the Name “EnableLog” and right click on it, click “Modify…” and change Value data from 0 to 1.
After modifying this setting, go back to your Sitecore website and hit refresh (restart your computer if the error message does not change). Now you can see the binding log:
=== Pre-bind state information === LOG: DisplayName = Oracle.DataAccess, Version=22.214.171.124, Culture=neutral, PublicKeyToken=89b483f429c47342 (Fully-specified) LOG: Appbase = file:///C:/inetpub/wwwroot/dotcom3/Website/ LOG: Initial PrivatePath = C:\inetpub\wwwroot\dotcom3\Website\bin Calling assembly : Sitecore.Oracle, Version=126.96.36.199, Culture=neutral, PublicKeyToken=null. === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\inetpub\wwwroot\dotcom3\Website\web.config LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Post-policy reference: Oracle.DataAccess, Version=188.8.131.52, Culture=neutral, PublicKeyToken=89b483f429c47342 LOG: The same bind was seen before, and was failed with hr = 0x80070002. Stack Trace: [FileNotFoundException: Could not load file or assembly 'Oracle.DataAccess, Version=184.108.40.206, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.] System.RuntimeTypeHandle.GetDeclaringType(RuntimeType type) +0 System.RuntimeTypeCache.GetEnclosingType() +27 Nancy.TinyIoc.TinyIoCContainer.<AutoRegisterInternal>b__13(Type type) +80 System.Linq.WhereListIterator`1.MoveNext() +79 Nancy.TinyIoc.TinyIoCContainer.AutoRegisterInternal(IEnumerable`1 assemblies, Boolean ignoreDuplicateImplementations, Func`2 registrationPredicate) +652 Nancy.DefaultNancyBootstrapper.AutoRegister(TinyIoCContainer container, IEnumerable`1 ignoredAssemblies) +270 Nancy.Bootstrapper.NancyBootstrapperBase`1.Initialise() +191 Nancy.Hosting.Aspnet.NancyHttpRequestHandler..cctor() +44 [TypeInitializationException: The type initializer for 'Nancy.Hosting.Aspnet.NancyHttpRequestHandler' threw an exception.] Nancy.Hosting.Aspnet.NancyHttpRequestHandler..ctor() +0
The first block of red text tells us the calling assembly is Sitecore.Oracle. If you open that dll using a decompiler such as dotPeek you can see under References near Oracle.DataAccess there is a question mark, and Location is empty in Properties.
From the second block of red text you can see that an exception is thrown by Nancy, a lightweight .Net framework for building HTTP based services. Sitecore.Ship has added a dependency Nancy.Hosting.AspNet. You’d think with the uninstallation of Sitecore.Ship this dependency should go away, but it doesn’t. This configuration is done in your Sitecore wwwroot/Website/Web.config file and it’s not removed upon uninstallation. Before installing Sitecore.Ship everything worked fine because although the Oracle.DataAccess assembly doesn’t exist, it was not being called.
So, find these lines in your Web.config file and remove them:
<add name="Nancy" verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" /><remove name="Sitecore.Ship" /><add name="Sitecore.Ship" verb="*" type="Sitecore.Ship.AspNet.SitecoreShipHttpHandler, Sitecore.Ship.AspNet" path="/services/*" /> <httpHandlers> <add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" /> <add verb="*" type="Sitecore.Ship.AspNet.SitecoreShipHttpHandler, Sitecore.Ship.AspNet" path="/services/*" /> </httpHandlers>
Now the error message should go away. Remember to delete the EnableLog registry value in Registry Editor.
Feel free to let me know your thoughts.