RemotingPortal fails when CSLA is moved from bin to GAC

RemotingPortal fails when CSLA is moved from bin to GAC

Old forum URL: forums.lhotka.net/forums/t/12058.aspx


martinjd posted on Wednesday, July 03, 2013

I have a RemotingPortal configured and it works as it should. I have the following reference in the web,config:

<add assembly="Csla, Version=2.0.0.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30" />

I believe we are still on the older version because there are so many different solutions in place that utilize CSLA and we have not had an opportunity to evaluate the impact of changing versions across the board.

As noted above the RemotingPortal works but we have recently had an issue occur that requires us to move out assemblies out of the web application's bin folder and into the GAC. When CSLA is moved to the GAC the RemotingPortal no longer works. As soon as I move CSLA back to the bin it works again. Below is the error that occurs when CSLA is moved to the GAC. Is there a setting I am missing somewhere that will tell the RemotingPortal that CSLA is now in the GAC?

This is the output when I navigate to

https://www.site.com/RemotingPortal.rem?wsdl

System.IO.FileNotFoundException: Could not load file or assembly 'Csla' or one of its dependencies. The system cannot find the file specified.
File name: 'Csla'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at System.Runtime.Remoting.RemotingConfigHandler.RemotingConfigInfo.LoadType(String typeName, String assemblyName)
   at System.Runtime.Remoting.RemotingConfigHandler.RemotingConfigInfo.GetServerTypeForUri(String URI)
   at System.Runtime.Remoting.RemotingServices.GetServerTypeForUri(String URI)
   at System.Runtime.Remoting.Channels.Http.HttpRemotingHandler.CanServiceRequest(HttpContext context)
   at System.Runtime.Remoting.Channels.Http.HttpRemotingHandler.InternalProcessRequest(HttpContext context)

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable  c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = DOMAIN\user
LOG: DisplayName = Csla
 (Partial)
LOG: Appbase = file:///C:/inetpub/wwwroot/wss/VirtualDirectories/www.site.com443/
LOG: Initial PrivatePath = C:\inetpub\wwwroot\wss\VirtualDirectories\www.site.com443\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\inetpub\wwwroot\wss\VirtualDirectories\www.site.com443\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\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/Framework64/v2.0.50727/Temporary ASP.NET Files/root/f8305cdb/d34d5b87/Csla.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/root/f8305cdb/d34d5b87/Csla/Csla.DLL.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/wss/VirtualDirectories/www.site.com443/bin/Csla.DLL.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/wss/VirtualDirectories/www.site.com443/bin/Csla/Csla.DLL.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/wss/VirtualDirectories/www.site.com443/_app_bin/Csla.DLL.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/wss/VirtualDirectories/www.site.com443/_app_bin/Csla/Csla.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/root/f8305cdb/d34d5b87/Csla.EXE.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/root/f8305cdb/d34d5b87/Csla/Csla.EXE.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/wss/VirtualDirectories/www.site.com443/bin/Csla.EXE.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/wss/VirtualDirectories/www.site.com443/bin/Csla/Csla.EXE.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/wss/VirtualDirectories/www.site.com443/_app_bin/Csla.EXE.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/wss/VirtualDirectories/www.site.com443/_app_bin/Csla/Csla.EXE.

 

 

JonnyBee replied on Wednesday, July 03, 2013

Hi,

Is the CSLA assembly signed and is the certificate still valid? 

martinjd replied on Wednesday, July 03, 2013

It is signed and I assume that the certificate is valid. I don't have any issues if the file that I move to the GAC is copied back to the bin.

JonnyBee replied on Wednesday, July 03, 2013

Try this:

After you have added the assembly to GAC.

(and remember that .NET 4 and .NET 2.0/3.0/3.5 have different GAC storages)

martinjd replied on Wednesday, July 03, 2013

It is available to select. I should also add that we have other code within this same Web  / SharePoint application that make calls to CSLA locally and not through the RemotingPortal service that are working correctly after moving CSLA to the GAC. It seems to be only the RemotingPortal that is affected which in turn prevents the application that uses the RemotingPortal service from working.

 

 

JonnyBee replied on Wednesday, July 03, 2013

Could this be the reason? 

http://stackoverflow.com/questions/1487218/wcf-service-unable-to-load-referenced-assemblies-from-the-gac 

I noticed from from the assembly load trace that the assembly loader did not look into GAC to get the assembly. 

JonnyBee replied on Wednesday, July 03, 2013

And also a nice articel from Scott Hanselman on debugging loader errors

Back to Basics: Using Fusion Log Viewer to Debug Obscure Loader Errors

martinjd replied on Wednesday, July 03, 2013

I already have the assembly referenced in the web.config and my WCF services work just not the RemotingPortal. Unfortunately Fusion doesn't show anything related to the CSLA assembly. I appreciate your help. 

martinjd replied on Thursday, July 04, 2013

When I access the web site default entry page I can see the w3wp process access CSLA as shown below in Fusion which does not use the remoting portal.

*** Assembly Binder Log Entry  (7/4/2013 @ 7:01:06 PM) ***

The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable  c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = JEMS\spadmin
LOG: DisplayName = Csla, Version=2.0.0.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30
(Fully-specified)
LOG: Appbase = file:///C:/inetpub/wwwroot/wss/VirtualDirectories/jclglocal.jacobstechnology.com443/
LOG: Initial PrivatePath = C:\inetpub\wwwroot\wss\VirtualDirectories\jclglocal.jacobstechnology.com443\bin
LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\f8305cdb
LOG: Cache Base = C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\f8305cdb
LOG: AppName = d34d5b87
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\inetpub\wwwroot\wss\VirtualDirectories\jclglocal.jacobstechnology.com443\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Binding succeeds. Returns assembly from C:\Windows\assembly\GAC_MSIL\Csla\2.0.0.0__93be5fdc093e4c30\Csla.dll.
LOG: Assembly is loaded in default load context.

 

When I then attempt to start the application that accesses the remoting portal Fusion reports that CSLA is found by that application as shown below.

 

*** Assembly Binder Log Entry  (7/4/2013 @ 7:54:52 PM) ***

The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable  D:\RADWorkspace\JETS\main\src\Core\bin\JTSEstimator.vshost.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = JEMS\James.Martin
LOG: DisplayName = Csla
(Partial)
LOG: Appbase = file:///D:/RADWorkspace/JETS/main/src/Core/bin/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = JTSEstimator.exe
Calling assembly : Csla, Version=2.0.0.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\RADWorkspace\JETS\main\src\Core\bin\JTSEstimator.vshost.exe.Config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\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:///D:/RADWorkspace/JETS/main/src/Core/bin/Csla.DLL.
LOG: Assembly download was successful. Attempting setup of file: D:\RADWorkspace\JETS\main\src\Core\bin\Csla.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Csla, Version=2.0.0.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30
LOG: A partially-specified assembly bind succeeded from the application directory. Need to re-apply policy.
LOG: Using application configuration file: D:\RADWorkspace\JETS\main\src\Core\bin\JTSEstimator.vshost.exe.Config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Csla, Version=2.0.0.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30
LOG: Binding succeeds. Returns assembly from C:\Windows\assembly\GAC_MSIL\Csla\2.0.0.0__93be5fdc093e4c30\Csla.dll.
LOG: Assembly is loaded in default load context.

 

The application fails to load because it is expecting certain data from the remoting portal and is instead receiving the error message. When I attempt to access the remoting portal by url Fusion reports:

 

*** Assembly Binder Log Entry  (7/4/2013 @ 8:00:06 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable  c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = JEMS\spadmin
LOG: DisplayName = Csla
(Partial)
LOG: Appbase = file:///C:/inetpub/wwwroot/wss/VirtualDirectories/jclglocal.jacobstechnology.com443/
LOG: Initial PrivatePath = C:\inetpub\wwwroot\wss\VirtualDirectories\jclglocal.jacobstechnology.com443\bin
LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\f8305cdb
LOG: Cache Base = C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\f8305cdb
LOG: AppName = d34d5b87
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\inetpub\wwwroot\wss\VirtualDirectories\jclglocal.jacobstechnology.com443\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\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: The same bind was seen before, and was failed with hr = 0x80070002.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80070002).

 

Which is also what is displayed in Internet Explorer when I access the remoting portal.

 

I noticed that when I access the web application default page or the remoting portal url they both look to the same web.config but the latter of the two fails.

martinjd replied on Thursday, July 11, 2013

While researching another issue I ran across a post that made me revisit your comments above. The actual fix was to add the following to the web.config in addition to the assembly reference which had already been added. Thanks again for your help.

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <qualifyAssembly partialName="Csla" fullName="Csla, Version=2.0.0.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30"/>
    </assemblyBinding>
</runtime>

 

http://entlib.codeplex.com/discussions/395784

https://entlib.codeplex.com/workitem/26903

 

 

Copyright (c) Marimer LLC