the sandman
the sandman

Reputation: 1029

Receive "Could not load file or assembly"..."The system cannot find the file specified" error for DLL only on Production

I have an ASP.net 4.0 website that uses Telerik controls. Recently the past dev who is no longer with the company upgraded the Telerik controls version.

The website works great locally and after i publish it and move it to my DEV environment(previous site wiped out and replaced with entire published new site) it works great with no issues.

As soon as i move the published version to production it errors every single time, with the following message(screenshot attached):

Could not load file or assembly 'Telerik.Web.Design, Version=2011.2.915.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies. The system cannot find the file specified.

I know the DLL exists there and is the same version "2011.2.915.40". I am really stumped as i have moved this back and forth and for some reason it only errors once moved to prod?

Error Screenshot

Error Screenshot

Upvotes: 0

Views: 7293

Answers (3)

the sandman
the sandman

Reputation: 1029

So i feel really stupid, but i had to add the Telerik.Web.Design.dll to the bin on Prod. The weird part is the DLL was never part of this project and locally and DEV worked great.

I did a search on my computer, found it and then added it. Not sure why Local and DEV worked without it, but its now fixed that i added it to the BIN.

Telerik.Web.Design.dll

Upvotes: 3

iJade
iJade

Reputation: 23791

Seems like the same problems i encountered.Try putting all required dlls in the bin folder in production.

Upvotes: 0

twoflower
twoflower

Reputation: 6830

Try to locate which Telerik assembly your site is trying to load, it may still be reaching up to some old version in ASP.NET temporary files. Happened to me too.

For debugging issues like this, I set the AppDoman.AssemblyLoad handler in my Global.asax.cs:

var appDomain = AppDomain.CurrentDomain;
appDomain.AssemblyLoad += AssemblyLoadEventHandler;

LogLoadedAssemblies();

using these:

private void LogLoadedAssemblies()
{
    var log = LogManager.GetLogger("AssemblyLoadHandler");
    foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
    {
        log.Info("Already loaded: " + assembly.FullName + " (" + (assembly.IsDynamic ? "dynamic" : assembly.Location) + ")");
    }
}

static void AssemblyLoadEventHandler(object sender, AssemblyLoadEventArgs args)
{
    LogManager.GetLogger("AssemblyLoadHandler").Info("Assembly loaded: " + args.LoadedAssembly.FullName + " (" + (args.LoadedAssembly.IsDynamic ? "dynamic" : args.LoadedAssembly.Location) + ")");
}

I use the log4net logger, but I believe you can easily adapt this code to your logging infrastructure.

Upvotes: 1

Related Questions