protected override object DoGetInstance(Type serviceType, string key) problem.

Jul 19, 2010 at 8:59 PM

Hi, I have a problem trying to deploy the package.

When I tried to create [Partner:ContosoPartner1][IncidentId:1] - X-ray machine: Installation issues. at http://localhost:8585/Contoso.LOB.Web/NewIncidentSite.aspx.

It throws No type mapping was registered for type 'IPartnerSiteDirectory' and key ''.

Then I debug into the program, saw that at "C:\Contoso\Source\Microsoft.Practices.SPG2\Microsoft.Practices.SPG.Common\ServiceLocation\ActivatingServiceLocator.cs"

protected override object DoGetInstance(Type serviceType, string key)
            if (!typeMappingsDictionary.ContainsKey(serviceType.AssemblyQualifiedName))
                throw BuildNotRegisteredException(serviceType, key);
            Dictionary<string, TypeMapping> mappingsForType = typeMappingsDictionary[serviceType.AssemblyQualifiedName];

            if (!mappingsForType.ContainsKey(PreventNull(key)))
                throw BuildNotRegisteredException(serviceType, key);

            TypeMapping typeMapping = mappingsForType[PreventNull(key)];

            if (typeMapping.InstantiationType == InstantiationType.AsSingleton)
                return GetSingleton(typeMapping);

            return CreateInstanceFromTypeMapping(typeMapping);

It crashed at the first if statement, throws BuildNotRegisteredException

It tried to find ServiceType.AssemblyQualifiedName: "Contoso.PartnerPortal.PartnerDirectory.IPartnerSiteDirectory, Contoso.PartnerPortal.PartnerDirectory, Version=, Culture=neutral, PublicKeyToken=c400335bb9134c42" which I dont have in the typeMappingDictionary.

I have been stuck here for a long time. Please help.

Thank you.


Jul 20, 2010 at 11:02 PM

I am trying to take a look at this for you, unfortunately my VM died and I'm building a new one for MOSS 2007.

Jul 27, 2010 at 11:32 PM

I'ld like to reproduce the crash. What is you envrionment (OS, 32/64 bits, IIS version, MOSS version, MOSS install Stand-alone/farm).

Jul 28, 2010 at 3:36 AM


My enviroment is Windows Server 2003 R2 32bit, IIS 6, MOSS 2007 standalone, VS 2008 SP1.

What I did for installing the sample was running the autobuild batch file.Built the solution, made some necessary changes such as install SSL, change the machineName in web.config, nothing more...

Then I ran into this kind of problem.

If you have a running version, could u debug into this, and check if "Contoso.PartnerPortal.PartnerDirectory.IPartnerSiteDirectory, Contoso.PartnerPortal.PartnerDirectory, Version=, Culture=neutral, PublicKeyToken=c400335bb9134c42" should be in the typeMappingDictionary?

Thank you.

Jul 30, 2010 at 12:50 AM

I did the following:

browse to:  http://localhost:8585/Contoso.LOB.Web/NewIncidentSite.aspx
Select:  [Paratner:ContosoPartner1][IncidentId:1] - X-ray machine: Installation issues
Click:  Create Site

I don't have any issues.

Could you verify the folloiwng link to see if you can access the pages? 


Aug 6, 2010 at 1:49 AM

I am a little overwhelmed at work these days. I will test these links during this weekend. I will let you know the result. Thank you for the detailed response.

Aug 12, 2010 at 8:10 PM
Hi, I have tested all the links. All accessible. still when I hit http://localhost:8585/Contoso.LOB.Web/NewIncidentSite.aspx and tried to create Partner1, Incident 1 , it throws me an exception ... 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.ServiceModel.FaultException`1[[System.ServiceModel.ExceptionDetail, System.ServiceModel, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]]: Activation error occured while trying to get instance of type IPartnerSiteDirectory, key "" Source Error: Line 49: Line 50: public void CreateSubSite(string businessEvent, string eventIdentifier, string entityId) { Line 51: base.Channel.CreateSubSite(businessEvent, eventIdentifier, entityId); Line 52: } Line 53: } Source File: C:\Contoso\Source\PartnerPortal\Contoso.LOB.Web\Service References\Contoso.PartnerPortal.Services.SubSiteCreation\Reference.cs Line: 51 I will try to deploy a new version on VM.
Aug 12, 2010 at 11:28 PM

You may want to debug you code:

1) IE to http://localhost:8585/Contoso.LOB.Web/NewIncidentSite.aspx

2) start Visual Stuidio 2008 as admin and open \Source\PartnerPortal\Contoso.PartnerPortal.sln

3) expand Contoso.PartnerPortal.Services project and open SubSiteCreation.cs

4) put a break point at the beginning of public void CreateSubSite(string businessEvent, string eventIdentifier, string entityId)


5) attache the debug to all W3WP.exe processes (you need to check "Show processes from all users"

6) in the NewIncidentSite.aspx page, click "Create Site" to break in to the code ...


You may also play with the various settings in Web.config in Contoso.PartnerPortal.Services project to see if you can fix the issue.