Solved

Could not load file or assembly

Posted on 2008-10-09
11
1,631 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
ID: 22683612
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
ID: 22688898
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
ID: 22691302
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:indacrypt
ID: 22702006
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
ID: 22704705
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
 
LVL 5

Expert Comment

by:harwantgrewal
ID: 22707066
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
ID: 22707099
Is it a strongly Named assembly?
0
 

Author Comment

by:indacrypt
ID: 22710926
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
ID: 22711204
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
ID: 22711789
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
ID: 22720295
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

786 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