Solved

Could not load file or assembly

Posted on 2008-10-09
11
1,616 Views
Last Modified: 2013-11-07
Hello,
I know there are many qs. similar to this one, but I just wanted to know what it meants to "re-add the reference" and rebild the program":, which is what was given as one of the solutions that worked. I can't imagine itbeing as easy as just rentering stuff into the web.config file. The  linked config files being referenced in my web.config file all point to loations on a remote server that I am able to acess without any problem by going directly to those folders (theyre all on the same intranet). If someone could please point me in the right direction to resolving this issue tht would be great!
Thanks in advance!
-D
0
Comment
Question by:indacrypt
  • 7
  • 4
11 Comments
 
LVL 5

Accepted Solution

by:
harwantgrewal earned 250 total points
Comment Utility
If you are using some reference file which are on network then you need to change the .NET policies so that those referece assembly could get executed.

Thanks
Harry
0
 

Author Comment

by:indacrypt
Comment Utility
Hi Harry
Thank you. How do i go about doing this pls? Im a .net newbie...
Thanks in advance
-D
0
 
LVL 5

Expert Comment

by:harwantgrewal
Comment Utility
0
 

Author Comment

by:indacrypt
Comment Utility
Hello,
Thanks for the link, but I have already followed those steps and .snk file isnt relevant in this case i.e Im not using one. The error that I see is "Could not load file or assembly '<assemblynamehere>' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) " . I  see error in the assmebly load trace like
"LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind)."
I dont understand why it says no application config file found when I have one sitting right in the folder where the application is being loaded from.... Ive also copied the dlls into the bin directory so I jsut dont get this error. If someone can please help me out that'll be great. Thanks!
0
 

Author Comment

by:indacrypt
Comment Utility
This is the stack trace while trying to laod the assembly that fils. Can anyone tell me what assembly namesa re being compared in the step labeled"WRN" that is resulting in a mismatch?? I also dont know why it keeps saying no application config. file found:((


=== Pre-bind state information ===
LOG: User = <userid>
LOG: DisplayName = <assemblyname>
 (Partial)
LOG: Appbase = file:///c:/inetpub/wwwroot/
LOG: Initial PrivatePath = c:\inetpub\wwwroot\bin
LOG: Dynamic Base = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\26676eb7
LOG: Cache Base = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\26676eb7
LOG: AppName = 92c7e946
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\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/v2.0.50727/Temporary ASP.NET Files/root/26676eb7/92c7e946/asemblyname.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/26676eb7/92c7e946/asesmblyname.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/bin/asemblyname.DLL.
DLL.
LOG: Assembly download was successful. Attempting setup of file: c:\inetpub\wwwroot\bin\asemblyname.DLL
LOG: Entering download cache setup phase.
LOG: Assembly Name is: MSDotNet.Directory, Version=<version number>, Culture=neutral, PublicKeyToken=<publickkey>
WRN: Comparing the assembly name resulted in the mismatch: NAME
ERR: The assembly reference did not match the assembly definition found.
ERR: Setup failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 5

Expert Comment

by:harwantgrewal
Comment Utility
I thin the culprit in the LOG is
Calling assembly : (Unknown).
Its trying to call an unknown assembly. What assembly you are trying to download and use it from Server? Is it a custom DLL or what?

Harry

0
 
LVL 5

Expert Comment

by:harwantgrewal
Comment Utility
Is it a strongly Named assembly?
0
 

Author Comment

by:indacrypt
Comment Utility
Hello,

Pls correct me if im wrong, but for an assembly to be strongly named, there has to be a keypair specified in the assemblyinfo.cs file correct? i.e  there has to be a .snk file? if thats the case, then no its not a strongly named assembly but yes it is a custom dll. Its a dll that has been customized by the company. I know that the code itself works because its out there in production and working fine..its only when im trying to get all this to work on my local machine:( Thanks in advance!
0
 

Author Comment

by:indacrypt
Comment Utility
the format for the web.config file is
<assemblies>
<add assembly="sybase.blahblah , Version=1.15.0.0, Culture=neutral,PublicKeyToken=somekey here" />

and then in the corresopnding bind sectioni have
assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <linkedConfiguration href="file:////path/1.0.2/Sybase.blahblah.dll.linked.config"/>

this is the directory specifiied for that version of the assembly. Is this a stronglynamed assembly? I thought it needs to include processor architecture as well to eb called strongly named....Also if it s strongly name I read on some other forums that I might have to regenerate the private key if its running on a different  machine? im so confused...too much info for a newbie lol. Thanks again !
0
 

Author Comment

by:indacrypt
Comment Utility
on another note, when I use local copies of the dlls I get the "Could not load file or assembly '<assemblynamehere>' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) "  errors and when I remove it I get the 'Parser Error Message: Could not load file or assembly 'simpleassemblyname, Version=6.0.0.0, Culture=neutral, PublicKeyToken=public key here' or one of its dependencies. The system cannot find the file specified." EVEN THOUGH i have all the references in the web.config file:( I read that in some cases it may be requried to regenerate the private keys for a strongly named assembly? How might be able to do this? I have granted FULL TRUST to the root folder of the  network share  where these assemblies com,e from using caspol. What else am i missing here pls...!
0
 

Author Comment

by:indacrypt
Comment Utility
I managed to figure this one out...well someone pointed it out and its the sillliest mistake possible. I hadn't configured the folder as an APPLICATION in IIS. the errors were sooo misleading. It seemed like there were so many things wrong with it but it turned out to be something as simple as this. I am awarding points to harwant for helping me out. Thank yoU!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now