Geeks With Blogs

I have a web service using Microsoft Unity to hook the pieces together.  It all works fine on my PC but when I put it on the web server, I receive this error message:

System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: The value of the property 'type' cannot be parsed. The error is: Method 'GetClaimsForUser' in type 'WebService.Implementation.ClaimsRetriever' from assembly 'WebService.Implementation, Version=, Culture=neutral, PublicKeyToken=62cac0f1a908971a' does not have an implementation.

If I look at the web.config, I see the following:

      <typeAlias alias="ITokenGenerator" type="WebService.Interfaces.ITokenGenerator, WebService.Interfaces" />
      <typeAlias alias="TokenGenerator" type="WebService.Implementation.TokenGenerator, WebService.Implementation" />
      <typeAlias alias="IClaimsRetriever" type="WebService.Interfaces.IClaimsRetriever, WebService.Interfaces" />
      <typeAlias alias="ClaimsRetriever" type="WebService.Implementation.ClaimsRetriever, WebService.Implementation" />
      <typeAlias alias="TokenGeneratorSettings" type="WebService.Implementation.TokenGeneratorSettings, WebService.Implementation" />
      <typeAlias alias="String" type="System.String, mscorlib" />
          <type type="ITokenGenerator" mapTo="TokenGenerator">
            <typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement, Microsoft.Practices.Unity.Configuration">
                <param name="retriever" parameterType="IClaimsRetriever">
                  <dependency />
                <param name="settings" parameterType="TokenGeneratorSettings">
                  <dependency />
          <type type="IClaimsRetriever" mapTo="ClaimsRetriever">
            <typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement, Microsoft.Practices.Unity.Configuration">
                <param name="connectionStringName" parameterType="String">
                  <value value="devDatabase" type="String" />

I have another web service, using an almost identical config running on the web server.  But this new web service will not run.

Any ideas on what I have not told Unity to do?  Or maybe what I told Unity to do incorrectly?

Posted on Monday, December 6, 2010 12:56 PM .Code | Back to top

Comments on this post: Unity works on my PC but not on the Server. What did I miss?

# re: Unity works on my PC but not on the Server. What did I miss?
Requesting Gravatar...
Well, I figured it out. I feel kind of dumb, but I realized Unity was truly telling me the truth -- just not in a way I thought of.

The error from Unity said I was missing an implementation when the 'GetClaimsForUser' method was called. So I checked for that method, found it, and really started to wonder what I had messed up in the Unity configuration.

The answer? I have several libraries being pulled into the final web service. My implementation library was trying to pull its reference to Microsoft.IdentityModel from the GAC and all other libraries were pulling this reference from a specific local directory. When I corrected this mismatch of IdentityModel, everything worked.

And when I think about it, the 'GetClaimsForUser' method relies on Microsoft.IdentityModel, so the Unity error message DOES make sense.

I hate it when the computer knows more than me...
Left by NEParis on Dec 09, 2010 7:31 AM

Your comment:
 (will show your gravatar)

Copyright © Erik France | Powered by: