1
votes

I have a web-site named CCESD set up in IIS7; my application root folder is D:\Websites\CCESD\CCESD. I also have a folder holding third-party assemblies (not all of which are strong-named) at D:\Websites\CCESD\CCESD\BinCommon: this is because I also have many other web applications under this root site in IIS that will share the DLLs, some of which are unmanaged code and so can't go in the GAC. My web.config file looks like this:

<compilation defaultLanguage="c#" debug="true" targetFramework="4.0"> 
  <assemblies> 
    ... 
    <add assembly="Telerik.Web.UI, Version=2012.1.288.40, Culture=neutral, PublicKeyToken=121FAE78165BA3D4" /> 
  </assemblies> 
</compilation> 

... 

<runtime> 
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
    <probing privatePath="BinCommon" /> 
  </assemblyBinding> 
</runtime>

However, when I try to run the web application, I get the following error (after enabling assembly-binding error logging):

Parser Error Message: Could not load file or assembly 'Telerik.Web.UI, Version=2012.1.288.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies. The system cannot find the file specified.

Source File: D:\Websites\CCESD\CCESD\web.config Line: 144

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Telerik.Web.UI, Version=2012.1.288.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4' could not be loaded.

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll

Running under executable c:\windows\system32\inetsrv\w3wp.exe

--- A detailed error log follows.

=== Pre-bind state information ===

LOG: User = IIS APPPOOL\CCESD

LOG: DisplayName = Telerik.Web.UI, Version=2012.1.288.40, Culture=neutral,PublicKeyToken=121fae78165ba3d4 (Fully-specified)

LOG: Appbase = file:///D:/Websites/CCESD/CCESD/

LOG: Initial PrivatePath = D:\Websites\CCESD\CCESD\bin Calling assembly : (Unknown). ===

LOG: This bind starts in default load context.

LOG: Using application configuration file: D:\Websites\CCESD\CCESD\web.configLOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config

LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.

LOG: Post-policy reference: Telerik.Web.UI, Version=2012.1.288.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/e11e9098/9e133b72/Telerik.Web.UI.DLL.

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/e11e9098/9e133b72/Telerik.Web.UI/Telerik.Web.UI.DLL.

LOG: Attempting download of new URL file:///D:/Websites/CCESD/CCESD/bin/Telerik.Web.UI.DLL.

LOG: Attempting download of new URL file:///D:/Websites/CCESD/CCESD/bin/Telerik.Web.UI/Telerik.Web.UI.DLL.

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/e11e9098/9e133b72/Telerik.Web.UI.EXE.

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/e11e9098/9e133b72/Telerik.Web.UI/Telerik.Web.UI.EXE.

LOG: Attempting download of new URL file:///D:/Websites/CCESD/CCESD/bin/Telerik.Web.UI.EXE.

LOG: Attempting download of new URL file:///D:/Websites/CCESD/CCESD/bin/Telerik.Web.UI/Telerik.Web.UI.EXE.

I have checked that the file exists and the version and public-key information are correct. What am I doing wrong?

1

1 Answers

1
votes

I found it eventually; in the end, it was down to this:

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

My project began life in Visual Studio 2005; hence the xmlns attribute shown above was present in the containing element of my web.config file. Removing it fixed the problem and now my assemblies are being loaded correctly.

Googling reveals that the xmlns attribute is there to enable intellisense in Visual Studio (which indeed it does): it says nothing about having any effect on loading assemblies, so this is all a little strange (not to mention annoying). Still, now it's working.