WCF Integration Facility throws exception: cannot load System.ServiceModel

668 views
Skip to first unread message

Uri Goldstein

unread,
Jun 28, 2009, 12:19:53 PM6/28/09
to Castle Project Users
Hi,

Might anyone know why the following exception is thrown when using the
WCf Integration Facility:

"Could not load file or assembly 'System.ServiceModel' or one of its
dependencies. The system cannot find the file specified. "

I'm not sure but I suspect this is related to my trying to inject an
IServiceBehavior with the facility.

Only if I set CopyLocal=true on the reference to System.ServiceModel
in my project does the exception go away. I assume the DLL is in the
GAC so why couldn't the WCF Integration Facility find it?


Thanks,
urig

Krzysztof Koźmic

unread,
Jun 28, 2009, 12:21:10 PM6/28/09
to castle-pro...@googlegroups.com
use fuslogvw and see what is the real problem

Uri Goldstein pisze:

Uri Goldstein

unread,
Jun 29, 2009, 7:42:26 AM6/29/09
to Castle Project Users
Hi Krzysztof, thanks for your help.

I've ascertained that this only happens when I try to register an
IBehavior to be injected through the Wcf Integration Facility like so:

<component id="myUserNameCredential"
service="System.ServiceModel.Description.IServiceBehavior,
System.ServiceModel" type="Common.MyUserNameCredential, Common" />

I couldn't quite get fuslogvw.exe to "catch" the bind error. Instead
I'm supplying the text of the server error that I receive from IIS:

----8<--------------------------------------------------------------------------------------------
Could not load file or assembly 'System.ServiceModel' or one of its
dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not load
file or assembly 'System.ServiceModel' or one of its dependencies. The
system cannot find the file specified.

Source Error:

Line 114: try
Line 115: {
Line 116: return Type.GetType(typeName, true, false);
Line 117: }
Line 118: catch (Exception e)


Source File: c:\Castle\InversionOfControl\Castle.Windsor\Installer
\DefaultComponentInstaller.cs Line: 116

Assembly Load Trace: The following information can be helpful to
determine why the assembly 'System.ServiceModel' could not be loaded.

=== Pre-bind state information ===
LOG: User = [..]
LOG: DisplayName = System.ServiceModel
(Partial)
LOG: Appbase = file:///C:/[..]/Site/
LOG: Initial PrivatePath = C:\[..]\Site\bin
Calling assembly : Castle.Windsor, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=407dd0808d44fbdc.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\[..]\Site\web.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/2ec7d594/f5851cc8/System.ServiceModel.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary
ASP.NET Files/root/2ec7d594/f5851cc8/System.ServiceModel/
System.ServiceModel.DLL.
LOG: Attempting download of new URL file:///C:/[..]/Site/bin/System.ServiceModel.DLL.
LOG: Attempting download of new URL file:///C:/[..]/Site/bin/System.ServiceModel/System.ServiceModel.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary
ASP.NET Files/root/2ec7d594/f5851cc8/System.ServiceModel.EXE.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary
ASP.NET Files/root/2ec7d594/f5851cc8/System.ServiceModel/
System.ServiceModel.EXE.
LOG: Attempting download of new URL file:///C:/[..]/Site/bin/System.ServiceModel.EXE.
LOG: Attempting download of new URL file:///C:/[..]/Site/bin/System.ServiceModel/System.ServiceModel.EXE.


Stack Trace:

[FileNotFoundException: Could not load file or assembly
'System.ServiceModel' or one of its dependencies. The system cannot
find the file specified.]
System.RuntimeTypeHandle._GetTypeByName(String name, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly,
StackCrawlMark& stackMark, Boolean loadTypeFromPartialName) +0
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly,
StackCrawlMark& stackMark) +64
System.RuntimeType.PrivateGetType(String typeName, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly,
StackCrawlMark& stackMark) +58
System.Type.GetType(String typeName, Boolean throwOnError, Boolean
ignoreCase) +65
Castle.Windsor.Installer.DefaultComponentInstaller.ObtainType
(String typeName) in c:\Castle\InversionOfControl\Castle.Windsor
\Installer\DefaultComponentInstaller.cs:116

[ConfigurationErrorsException: The type name
System.ServiceModel.Description.IServiceBehavior, System.ServiceModel
could not be located]
Castle.Windsor.Installer.DefaultComponentInstaller.ObtainType
(String typeName) in c:\Castle\InversionOfControl\Castle.Windsor
\Installer\DefaultComponentInstaller.cs:122
Castle.Windsor.Installer.DefaultComponentInstaller.SetUpComponents
(IConfiguration[] configurations, IWindsorContainer container) in c:
\Castle\InversionOfControl\Castle.Windsor\Installer
\DefaultComponentInstaller.cs:85
Castle.Windsor.Installer.DefaultComponentInstaller.SetUp
(IWindsorContainer container, IConfigurationStore store) in c:\Castle
\InversionOfControl\Castle.Windsor\Installer
\DefaultComponentInstaller.cs:41
Castle.Windsor.WindsorContainer.RunInstaller() in c:\Castle
\InversionOfControl\Castle.Windsor\WindsorContainer.cs:943
Castle.Windsor.WindsorContainer..ctor(IConfigurationInterpreter
interpreter) in c:\Castle\InversionOfControl\Castle.Windsor
\WindsorContainer.cs:78
Castle.Windsor.WindsorContainer..ctor(String xmlFile) in c:\Castle
\InversionOfControl\Castle.Windsor\WindsorContainer.cs:106
Site.Global.Application_Start(Object sender, EventArgs e) in C:\[..]
\Site\Global.asax.cs:29


Version Information: Microsoft .NET Framework Version:2.0.50727.3082;
ASP.NET Version:2.0.50727.3082
----8<--------------------------------------------------------------------------------------------


Thanks,
Uri.


On Jun 28, 7:21 pm, Krzysztof Koźmic <krzysztof.koz...@gmail.com>
wrote:

Krzysztof Koźmic

unread,
Jun 29, 2009, 10:32:24 AM6/29/09
to castle-pro...@googlegroups.com
Is your app compiled against .NET 3.5 SP1?

Uri Goldstein pisze:

Uri Goldstein

unread,
Jun 29, 2009, 10:55:55 AM6/29/09
to Castle Project Users
Yes. I'm compiling with .Net 3.5 SP1 (on Windows XP SP3).

Here is what fuslogvw.exe has to say, now that I've switched from
using WebDev.exe to IIS 5.1:

----8<--------------------------------------------------------------------------------------------
*** Assembly Binder Log Entry (29/06/2009 @ 17:43:43) ***

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\mscorwks.dll
Running under executable C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\aspnet_wp.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = MACHINENAME\ASPNET
LOG: DisplayName = System.ServiceModel
(Partial)
LOG: Appbase = file:///C:/[..]/Site/
LOG: Initial PrivatePath = C:\[..]\Site\bin
LOG: Dynamic Base = C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\Temporary ASP.NET Files\[..]\e98ebd2b
LOG: Cache Base = C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\Temporary ASP.NET Files\[..]\e98ebd2b
LOG: AppName = 27987877
Calling assembly : Castle.Windsor, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=407dd0808d44fbdc.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\[..]\Site\web.config
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/[..]/e98ebd2b/27987877/System.ServiceModel.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary
ASP.NET Files/[..]/e98ebd2b/27987877/System.ServiceModel/
System.ServiceModel.DLL.
LOG: Attempting download of new URL file:///C:/[..]/Site/bin/System.ServiceModel.DLL.
LOG: Attempting download of new URL file:///C:/[..]/Site/bin/System.ServiceModel/System.ServiceModel.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary
ASP.NET Files/[..]/e98ebd2b/27987877/System.ServiceModel.EXE.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary
ASP.NET Files/[..]/e98ebd2b/27987877/System.ServiceModel/
System.ServiceModel.EXE.
LOG: Attempting download of new URL file:///C:/[..]/Site/bin/System.ServiceModel.EXE.
LOG: Attempting download of new URL file:///C:/[..]/Site/bin/System.ServiceModel/System.ServiceModel.EXE.
LOG: All probing URLs attempted and failed.

----8<--------------------------------------------------------------------------------------------

Thanks,
Uri





On Jun 29, 5:32 pm, Krzysztof Koźmic <krzysztof.koz...@gmail.com>

Scott_M

unread,
Feb 24, 2014, 10:08:59 PM2/24/14
to castle-pro...@googlegroups.com

This is an old post but thought I would weigh in since my company is still kicking it old school with XML component registration over installers. In our case we used partial assembly name for System.ServiceModel as the O.P. did here. For whatever reason, this consistently fails. Oddly, fuslogvw provides a warn instead of an error for this scenario. So moral of story is use fully qualified assembly name for System.ServiceModel when registering WCF components such as IServiceBehavior and IErrorHandler.

Ex:

System.ServiceModel.Description.IServiceBehavior, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

"Many Bothans died to bring us this information."

Reply all
Reply to author
Forward
0 new messages