Unity cannot load assembly in WCF Service

Aug 7, 2010 at 7:06 AM

First, this is just testing, so best practices are not being used, I just need help with a problem I have been working on for hours .  Also, I am fairly new to unity.

I am debugging the service by attaching a debugger to the Service and running wcftestclient.exe.  The service is being run on the local IIS.

My unity configuration is in the Web.Config file.  

When I run this line "ContainerHelper.Container = UnityContainerHelper.CreateUnityContainer();" in the method, it errors out saying it cannot load assembly  "MyCompany.Services.Common".

<code snippet>

      <typeAlias alias="ISessionContainer"         type="MyCompany.Services.Common.ISessionContainer, MyCompany.Services.Common" />

</code snippet>

This assembly is referenced in the Service project and the DLL is in the bin folder of the appropriate folder where the svc file resides.  I could really use the help as I am stuck.


Aug 8, 2010 at 3:36 AM

I doubt it's anything Unity specific. What happens if you put:

Type t = Type.GetType("MyCompany.Services.Common.ISessionContainer, MyCompany.Services.Common");

in the code? I suspect that'll fail too. Once you get that working, Unity will work too.

Aug 9, 2010 at 2:29 PM

ctavares, thanks for the reply.  I figured out my problem and as you said, it had nothing to do with Unity.  It was a mix of erroneous configurations and some references that needed to be in my project.