Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Assembly binding problem

Reply
Thread Tools

Assembly binding problem

 
 
=?Utf-8?B?U3RldmVuIEJlcmtvdml0eg==?=
Guest
Posts: n/a
 
      02-27-2006
I have several ASP.NET applications with near identical web.config files. In
one of them I am successfuly able to bind to an assembly while on others I am
not.

All of them have the following qualifiers:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="OrderDynamics.ImageService.Interfaces "
fullName="OrderDynamics.ImageService.Interfaces,Ve rsion=1.0.0.0,Culture=neutral,PublicKeyToken=66306 5290036ba4e"/>
</assemblyBinding>
</runtime>

Using fusionlogvw, I can see that in the working app it is succesfuly using
the web.config file:

*** Assembly Binder Log Entry (2/27/2006 @ 2:57:41 PM) ***

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

Assembly manager loaded from:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msco rwks.dll
Running under executable
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspn et_wp.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = STEVENDOTNET\ASPNET
LOG: DisplayName = OrderDynamics.ImageService.Interfaces
(Partial)
LOG: Appbase = file:///C:/Visual Studio Projects/Nutrazone/Liposlim/
LOG: Initial PrivatePath = C:\Visual Studio Projects\Nutrazone\Liposlim\bin
LOG: Dynamic Base = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary
ASP.NET Files\liposlim\408be0eb
LOG: Cache Base = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary
ASP.NET Files\liposlim\408be0eb
LOG: AppName = 17777a67
Calling assembly : Business Logic, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=e07d99407b976026.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Visual Studio
Projects\Nutrazone\Liposlim\web.config
LOG: Using host configuration file:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspn et.config
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\conf ig\machine.config.
LOG: Partial reference qualified from config file. New reference:
OrderDynamics.ImageService.Interfaces, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=663065290036ba4e.
LOG: Binding succeeds. Returns assembly from
C:\WINDOWS\assembly\GAC_MSIL\OrderDynamics.ImageSe rvice.Interfaces\1.0.0.0__663065290036ba4e\OrderDy namics.ImageService.Interfaces.dll.
LOG: Assembly is loaded in default load context.


However the non working app shows:
*** Assembly Binder Log Entry (2/27/2006 @ 2:54:56 PM) ***

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

Assembly manager loaded from:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msco rwks.dll
Running under executable
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspn et_wp.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = STEVENDOTNET\ASPNET
LOG: DisplayName = OrderDynamics.ImageService.Interfaces
(Partial)
LOG: Appbase = file:///C:/Visual Studio Projects/Nutrazone/AdminUI/
LOG: Initial PrivatePath = C:\Visual Studio Projects\Nutrazone\AdminUI\bin
LOG: Dynamic Base = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary
ASP.NET Files\adminui\a7112056
LOG: Cache Base = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary
ASP.NET Files\adminui\a7112056
LOG: AppName = dd7b5eda
Calling assembly : Business Logic, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=e07d99407b976026.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Visual Studio
Projects\Nutrazone\AdminUI\web.config
LOG: Using host configuration file:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspn et.config
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\conf ig\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/adminui/a7112056/dd7b5eda/OrderDynamics.ImageService.Interfaces.DLL.
LOG: Attempting download of new URL
file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET
Files/adminui/a7112056/dd7b5eda/OrderDynamics.ImageService.Interfaces/OrderDynamics.ImageService.Interfaces.DLL.
LOG: Attempting download of new URL file:///C:/Visual Studio
Projects/Nutrazone/AdminUI/bin/OrderDynamics.ImageService.Interfaces.DLL.
LOG: Attempting download of new URL file:///C:/Visual Studio
Projects/Nutrazone/AdminUI/bin/OrderDynamics.ImageService.Interfaces/OrderDynamics.ImageService.Interfaces.DLL.
LOG: Attempting download of new URL
file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET
Files/adminui/a7112056/dd7b5eda/OrderDynamics.ImageService.Interfaces.EXE.
LOG: Attempting download of new URL
file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET
Files/adminui/a7112056/dd7b5eda/OrderDynamics.ImageService.Interfaces/OrderDynamics.ImageService.Interfaces.EXE.
LOG: Attempting download of new URL file:///C:/Visual Studio
Projects/Nutrazone/AdminUI/bin/OrderDynamics.ImageService.Interfaces.EXE.
LOG: Attempting download of new URL file:///C:/Visual Studio
Projects/Nutrazone/AdminUI/bin/OrderDynamics.ImageService.Interfaces/OrderDynamics.ImageService.Interfaces.EXE.
LOG: All probing URLs attempted and failed.


One line that pops out is
LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).


How do I find out why it is not applying the policy?


--
-Steven
 
Reply With Quote
 
 
 
 
=?Utf-8?B?U3RldmVuIEJlcmtvdml0eg==?=
Guest
Posts: n/a
 
      02-27-2006
I should also add that the assembly is in the GAC and if I drop it in the bin
directory it works fine.


--
-Steven


"Steven Berkovitz" wrote:

> I have several ASP.NET applications with near identical web.config files. In
> one of them I am successfuly able to bind to an assembly while on others I am
> not.
>
> All of them have the following qualifiers:
>
> <runtime>
> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
> <qualifyAssembly partialName="OrderDynamics.ImageService.Interfaces "
> fullName="OrderDynamics.ImageService.Interfaces,Ve rsion=1.0.0.0,Culture=neutral,PublicKeyToken=66306 5290036ba4e"/>
> </assemblyBinding>
> </runtime>
>
> Using fusionlogvw, I can see that in the working app it is succesfuly using
> the web.config file:
>
> *** Assembly Binder Log Entry (2/27/2006 @ 2:57:41 PM) ***
>
> The operation was successful.
> Bind result: hr = 0x0. The operation completed successfully.
>
> Assembly manager loaded from:
> C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msco rwks.dll
> Running under executable
> C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspn et_wp.exe
> --- A detailed error log follows.
>
> === Pre-bind state information ===
> LOG: User = STEVENDOTNET\ASPNET
> LOG: DisplayName = OrderDynamics.ImageService.Interfaces
> (Partial)
> LOG: Appbase = file:///C:/Visual Studio Projects/Nutrazone/Liposlim/
> LOG: Initial PrivatePath = C:\Visual Studio Projects\Nutrazone\Liposlim\bin
> LOG: Dynamic Base = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary
> ASP.NET Files\liposlim\408be0eb
> LOG: Cache Base = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary
> ASP.NET Files\liposlim\408be0eb
> LOG: AppName = 17777a67
> Calling assembly : Business Logic, Version=2.0.0.0, Culture=neutral,
> PublicKeyToken=e07d99407b976026.
> ===
> LOG: This bind starts in default load context.
> LOG: Using application configuration file: C:\Visual Studio
> Projects\Nutrazone\Liposlim\web.config
> LOG: Using host configuration file:
> C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspn et.config
> LOG: Using machine configuration file from
> C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\conf ig\machine.config.
> LOG: Partial reference qualified from config file. New reference:
> OrderDynamics.ImageService.Interfaces, Version=1.0.0.0, Culture=neutral,
> PublicKeyToken=663065290036ba4e.
> LOG: Binding succeeds. Returns assembly from
> C:\WINDOWS\assembly\GAC_MSIL\OrderDynamics.ImageSe rvice.Interfaces\1.0.0.0__663065290036ba4e\OrderDy namics.ImageService.Interfaces.dll.
> LOG: Assembly is loaded in default load context.
>
>
> However the non working app shows:
> *** Assembly Binder Log Entry (2/27/2006 @ 2:54:56 PM) ***
>
> The operation failed.
> Bind result: hr = 0x80070002. The system cannot find the file specified.
>
> Assembly manager loaded from:
> C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msco rwks.dll
> Running under executable
> C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspn et_wp.exe
> --- A detailed error log follows.
>
> === Pre-bind state information ===
> LOG: User = STEVENDOTNET\ASPNET
> LOG: DisplayName = OrderDynamics.ImageService.Interfaces
> (Partial)
> LOG: Appbase = file:///C:/Visual Studio Projects/Nutrazone/AdminUI/
> LOG: Initial PrivatePath = C:\Visual Studio Projects\Nutrazone\AdminUI\bin
> LOG: Dynamic Base = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary
> ASP.NET Files\adminui\a7112056
> LOG: Cache Base = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary
> ASP.NET Files\adminui\a7112056
> LOG: AppName = dd7b5eda
> Calling assembly : Business Logic, Version=2.0.0.0, Culture=neutral,
> PublicKeyToken=e07d99407b976026.
> ===
> LOG: This bind starts in default load context.
> LOG: Using application configuration file: C:\Visual Studio
> Projects\Nutrazone\AdminUI\web.config
> LOG: Using host configuration file:
> C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspn et.config
> LOG: Using machine configuration file from
> C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\conf ig\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/adminui/a7112056/dd7b5eda/OrderDynamics.ImageService.Interfaces.DLL.
> LOG: Attempting download of new URL
> file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET
> Files/adminui/a7112056/dd7b5eda/OrderDynamics.ImageService.Interfaces/OrderDynamics.ImageService.Interfaces.DLL.
> LOG: Attempting download of new URL file:///C:/Visual Studio
> Projects/Nutrazone/AdminUI/bin/OrderDynamics.ImageService.Interfaces.DLL.
> LOG: Attempting download of new URL file:///C:/Visual Studio
> Projects/Nutrazone/AdminUI/bin/OrderDynamics.ImageService.Interfaces/OrderDynamics.ImageService.Interfaces.DLL.
> LOG: Attempting download of new URL
> file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET
> Files/adminui/a7112056/dd7b5eda/OrderDynamics.ImageService.Interfaces.EXE.
> LOG: Attempting download of new URL
> file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET
> Files/adminui/a7112056/dd7b5eda/OrderDynamics.ImageService.Interfaces/OrderDynamics.ImageService.Interfaces.EXE.
> LOG: Attempting download of new URL file:///C:/Visual Studio
> Projects/Nutrazone/AdminUI/bin/OrderDynamics.ImageService.Interfaces.EXE.
> LOG: Attempting download of new URL file:///C:/Visual Studio
> Projects/Nutrazone/AdminUI/bin/OrderDynamics.ImageService.Interfaces/OrderDynamics.ImageService.Interfaces.EXE.
> LOG: All probing URLs attempted and failed.
>
>
> One line that pops out is
> LOG: Policy not being applied to reference at this time (private, custom,
> partial, or location-based assembly bind).
>
>
> How do I find out why it is not applying the policy?
>
>
> --
> -Steven

 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      02-28-2006
Hi Steven,

So have you got it working now? As for the "qualifyAssembly", it just used
to help redirect a partial assembly reference (ususally for dynamic
assembly loading) to a Full qualified assembly reference. And as long as
the web.config file is correctly configured, in your case, since the
assembly is a strong-named one, the runtime should always start searching
in the GAC, then through the normal assembly probing path( the bin sub dir
for ASP.NET web application).

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
=?Utf-8?B?U3RldmVuIEJlcmtvdml0eg==?=
Guest
Posts: n/a
 
      02-28-2006
Hi Steven,

This one IIS instance only works when the assembly is in the BIN folder, if
it is not, the qualifiedAssembly element seems to have no affect.

--
-Steven


"Steven Cheng[MSFT]" wrote:

> Hi Steven,
>
> So have you got it working now? As for the "qualifyAssembly", it just used
> to help redirect a partial assembly reference (ususally for dynamic
> assembly loading) to a Full qualified assembly reference. And as long as
> the web.config file is correctly configured, in your case, since the
> assembly is a strong-named one, the runtime should always start searching
> in the GAC, then through the normal assembly probing path( the bin sub dir
> for ASP.NET web application).
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      03-01-2006
Thanks for your response Steven,

Seems a bit strange. Are you dynamically use Assembly.Load to load the
assembly. Also, is any other simple strong-named assembly suffering the
same problem if use the qualifiedAssembly setting in the applccation or in
any other .net application on that machine?

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
=?Utf-8?B?U3RldmVuIEJlcmtvdml0eg==?=
Guest
Posts: n/a
 
      03-01-2006
Hi Steven,

I am using Activator.GetObject along with .NET remoting to load the assembly.

There are other strong named assemblies that are loading properly. There
seems to be a bug with the .NET remoting configuration where you can't use a
fullname to specify the assembly, so the workaround is to use the
qualifiedAssemblues

--
-Steven


"Steven Cheng[MSFT]" wrote:

> Thanks for your response Steven,
>
> Seems a bit strange. Are you dynamically use Assembly.Load to load the
> assembly. Also, is any other simple strong-named assembly suffering the
> same problem if use the qualifiedAssembly setting in the applccation or in
> any other .net application on that machine?
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      03-02-2006
Thanks for your response,

Then, the problem is somewhat specific to .NET remoting scenario. Is it the
server app or the client app? Based on my research , when configure service
object for remoting, we can provide their full qualified name in
application config file.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
=?Utf-8?B?U3RldmVuIEJlcmtvdml0eg==?=
Guest
Posts: n/a
 
      03-02-2006
Steven,

If I use the following config:

<system.runtime.remoting>
<application>
<channels>
<channel ref="http" useDefaultCredentials="true" port="0">
<clientProviders><formatter ref="binary"
typeFilterLevel="Full"/></clientProviders>
</channel>
</channels>
<client>
<wellknown url="http://10.1.0.24:80/ImageService/ImageService.rem"
type="OrderDynamics.ImageService.Interfaces.IImage Service,OrderDynamics.ImageService.Interfaces,Vers ion=1.0.0.0,Culture=neutral,PublicKeyToken=6630652 90036ba4e"/>
</client>
</application>
</system.runtime.remoting>


I get the following exception which states you can't have version
information in the assembly name.

Exception Details: System.Runtime.Remoting.RemotingException: .Config file
'C:\Visual Studio Projects\Nutrazone\AdminUI\web.config' cannot be read
successfully due to exception 'System.Runtime.Remoting.RemotingException:
Version information is present in the assembly name
'OrderDynamics.ImageService.Interfaces,Version=1.0 .0.0,Culture=neutral,PublicKeyToken=663065290036ba 4e' which is not allowed for 'client wellknown' entries.
at
System.Runtime.Remoting.Activation.RemotingXmlConf igFileParser.ReportError(String errorStr, RemotingXmlConfigFileData configData)
at
System.Runtime.Remoting.Activation.RemotingXmlConf igFileParser.ReportAssemblyVersionInfoPresent(Stri ng
assemName, String entryDescription, RemotingXmlConfigFileData configData)
at
System.Runtime.Remoting.Activation.RemotingXmlConf igFileParser.ProcessClientWellKnownNode(ConfigNode
node, RemotingXmlConfigFileData configData, RemoteAppEntry remoteApp)
at
System.Runtime.Remoting.Activation.RemotingXmlConf igFileParser.ProcessClientNode(ConfigNode node, RemotingXmlConfigFileData configData)
at
System.Runtime.Remoting.Activation.RemotingXmlConf igFileParser.ProcessApplicationNode(ConfigNode node, RemotingXmlConfigFileData configData)
at
System.Runtime.Remoting.Activation.RemotingXmlConf igFileParser.ParseConfigNode(ConfigNode rootNode)
at
System.Runtime.Remoting.RemotingConfigHandler.Load ConfigurationFromXmlFile(String filename)'.


--
-Steven


"Steven Cheng[MSFT]" wrote:

> Thanks for your response,
>
> Then, the problem is somewhat specific to .NET remoting scenario. Is it the
> server app or the client app? Based on my research , when configure service
> object for remoting, we can provide their full qualified name in
> application config file.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      03-03-2006
Thanks for response Steven,

Yes, I know the exception you mentioned, this is because you're using
<activated> object in your remoting server application, because for
<activated> type remote object, the version is determined by client
side(client side create the instance of which version, then the server
should create the instance of the corresponding version), there is no
needed to specify version info.(and it force us not to specify version in
server application's config file for activated type). However, we can
specify the version info for the activated type object in client
application's application config file, have you tried this?

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
=?Utf-8?B?U3RldmVuIEJlcmtvdml0eg==?=
Guest
Posts: n/a
 
      03-03-2006
Hi Steven,

That makes sense (as to why I don't need the full type info on the client),
however I am enumerating the GetRegisteredWellKnownClientEntries() collection
and when the full version info is not known, the ObjectType property of the
WellKnownClientTypeEntry is null which causes a problem when using
Activator.GetObject(type, entry.ObjectUrl)

--
-Steven


"Steven Cheng[MSFT]" wrote:

> Thanks for response Steven,
>
> Yes, I know the exception you mentioned, this is because you're using
> <activated> object in your remoting server application, because for
> <activated> type remote object, the version is determined by client
> side(client side create the instance of which version, then the server
> should create the instance of the corresponding version), there is no
> needed to specify version info.(and it force us not to specify version in
> server application's config file for activated type). However, we can
> specify the version info for the activated type object in client
> application's application config file, have you tried this?
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assembly binding redirections problem in .NET 2.0 Web Service =?Utf-8?B?UnVzc2VsbCBQb29sZXk=?= ASP .Net 0 02-02-2007 09:45 AM
Problem calling assembly which references another assembly from an asp page christianhaynes@hotmail.com ASP .Net 3 03-03-2006 04:52 PM
ASP.NET 2.0: What is the namespace and assembly name of generated assembly SA ASP .Net 0 08-09-2004 05:09 PM
Referencing assembly from GAC using @assembly fails Brent ASP .Net 1 01-23-2004 08:23 PM
can a strongly named assembly reference a regular assembly? Prasanna Padmanabhan ASP .Net 1 11-19-2003 06:21 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57