?
Solved

Could not load file or assembly

Posted on 2008-10-09
11
Medium Priority
?
1,660 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
11 Comments
 
LVL 5

Accepted Solution

by:
harwantgrewal earned 750 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

743 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