Could not load file or assembly...

Discussion in 'Windows / IIS' started by davehollis, Oct 17, 2013.

  1. Hello,
    I'm getting this error on my newly uploaded IIS7 .NET 4.0 website. I recently converted a 3.5 website and it works fine on my local machine. However, when you go to a page on the discountasp website it gives the following error:
    Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Configuration.Design, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

    (see also attached photo). If I refresh the page it goes away, but will come back if there's no activity for a few minutes.

    It doesn't matter if I upload the above .dll file to the bin directory or not - same error. I don't have reference to it in my web.config file (should I?). From the attached photo, you can see that it has something to do with
    ajaxToolkit:ToolkitScriptManager. I'm at a loss. Any help is appreciated! ErrorAssembly.JPG
     
  2. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    You need to upload the AjaxToolkit library to the /bin folder as well.
     
  3. Thanks for the response, Ray! I've been trouble-shooting this for the past few hours and here's my findings.

    I've got the AjaxToolkit in the /bin folder. I've even tried upgrading to a more recent version, but it gives me the same error. It seems that the "microsoft.practices...design" dll that the web app is finding must be located in the GAC and it isn't the version that my web app is looking for. So I can't override it. What puzzles me is that when I refresh the page right away it goes away. Then if I leave the page for 30 min or so and try to refresh or go to a different link on the page, I get the error again. Any thoughts here?
     
  4. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    Make sure you include that .dll as a reference in your Visual Studio project and set the Copy Local value to true. This should put it in your /bin folder locally when you recompile. Then re-upload your application. It should be pulling the assembly from the /bin folder instead of the GAC.

    Make sure you recompile too because I know I had to. I wrote an application once with multiple database connection strings, and it didn't work properly because it wasn't referencing the correct connection string in the assembly.
     
    mjp likes this.
  5. Hey Ray,
    That sounds like it's going in the right direction. If I can use the local assembly rather than the GAC one. How will this work though if I'm working outside of a project? I.e. I'm working with files in the root web folder so there isn't a project to compile that would be associated with that dll. The ajax reference has no project since it's just a dll reference. I've done a "add reference", browsed to the "microsoft.practices...design" dll (version 3.1.0.0) and added it so that it shows up in the /bin folder. But it doesn't do any good. Is there some way to tell the application to use only that local dll like you would in a project?

    I've got about 20 projects within the web application. But none associated with ajax toolkit. Thoughts? I really appreciate the help!
     
  6. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    You should be able install the AjaxControlToolkit for each project using the NuGet manager. That adds a reference and puts the assemblies in the /bin folder of the project.
     
  7. Hi Ray,
    I'm going on day 3 here. Not much luck yet. I decided to use the NeGet manager and install the latest AjaxControlToolKit. Then I uploaded all of the new files associated with that to the /bin directory of the discountasp website. Now I get the same error:
    Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Configuration.Design, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
    Then when I refresh I get the error:
    The requested script resource 'Common.Common.js' requires version 'AjaxControlToolkit, Version=4.1.7.1005, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' of the ASP.NET AJAX Framework. To use this resource, make sure that the application references version 'AjaxControlToolkit, Version=4.1.7.1005, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e'.
    This error doesn't identify where the problem lies - just the reference to Common.Common.js, which doesn't exist anywhere in my web app or projects. Everything works fine on my local machine.

    My thoughts are that on my local machine I don't have much in my GAC that would conflict so it picks up all assemblies from those in the web app. These are all compatible so I have no problem. Everything stems from the ajax assembly. And it doesn't seem to matter if I add it to each project or just to the web application itself. :(
     
  8. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    Hi,

    Sorry, but I'm going to ask the obvious. Is your hosting account on Windows 2008/IIS7, and did you set the .NET Framework to 4.0?
     
  9. Ray,
    I believe it's 2008. It's IIS7 and I set the .NET 4.0 framework. But, I think I've figured it out. I ended up deleting everything on the server except for images and aspx files. Then I re-uploaded everything again. Now it seems to be working. I guess when I used NuGet to upgrade the version of AjaxToolkit it must have changed more than just the Ajax files and web.config. I imagine that it also updated some other dlls in the process and by re-uploading everything I managed to upload those changes as well. I'm still not sure what additional files it affected, but the process of upgrading and mass-reloading did the trick. I think I'd still be having these issues if I was trying to work from the older version of Ajax Toolkit. Wow, what an ordeal. So far so good. I keep checking and I'm not getting any errors.

    Thanks for all your help in this! You kept me plugging away at it!
     
  10. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    Great to hear! I'm glad you were able to figure it out. :)
     
  11. Ray,
    I've been avoiding writing back since it only puts more egg on my face. But the "solution" I thought I had really isn't working. It only suppresses the problem more. But it still shows up periodically, so I'm really no closer to the solution as far as I can tell.

    Do you know of any paid service that I could get involved with this to try and resolve my problem? My technical skills appear to be maxed out and maybe there's someone out there who I can pay to do some trouble-shooting. I appreciate it!
     
  12. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

  13. I have a webservice which basically do finger print macthing(using c language dll), the web service is running fine on visual studio and on local iis. But when i run web service to hosting server(making it live) it give error following error

    Could not load file or assembly 'FPMatchingDLL.DLL' or one of its dependencies. The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail. (Exception from HRESULT: 0x800736B1)
    Kindly help me in this regard
    thanks
     
  14. My problem ended up being several dlls that were conflicting. What I would suggest doing is making a very basic page that accesses that dll. Then strip out all other assemblies and adding them back in one at a time until you have only what you need to run that functionality. If you can accomplish that on the hosting server then you'll know if it's some other assembly you previously uploaded that is conflicting with your FPMatchingDLL.
     
    FrankC, martino, mjp and 1 other person like this.

Share This Page