• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1674
  • Last Modified:

Could not load file or assembly

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
indacrypt
Asked:
indacrypt
  • 7
  • 4
1 Solution
 
harwantgrewalCommented:
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
 
indacryptAuthor Commented:
Hi Harry
Thank you. How do i go about doing this pls? Im a .net newbie...
Thanks in advance
-D
0
 
harwantgrewalCommented:
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
indacryptAuthor Commented:
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
 
indacryptAuthor Commented:
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
 
harwantgrewalCommented:
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
 
harwantgrewalCommented:
Is it a strongly Named assembly?
0
 
indacryptAuthor Commented:
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
 
indacryptAuthor Commented:
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
 
indacryptAuthor Commented:
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
 
indacryptAuthor Commented:
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

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now