Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 711201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:42:29+00:00 2026-05-14T04:42:29+00:00

When I attempt to instantiate my instance of the base class I get the

  • 0

When I attempt to instantiate my instance of the base class I get the error:

a ResolutionFailedException with roughly the following error “The parameter host could not be resolved when attempting to call constructor”

I’m currently not using an Interface for the base type and my instance of the class is inheriting the base type class. I’m new to Unity and DI so I’m thinking its something I forgot possibly.

ExeConfigurationFileMap map = new ExeConfigurationFileMap();
map.ExeConfigFilename = "Unity.Config";
Configuration config = ConfigurationManager.OpenMappedExeConfiguration(map,  ConfigurationUserLevel.None);
UnityConfigurationSection section = (UnityConfigurationSection)config.GetSection("unity");
IUnityContainer container = new UnityContainer();
section.Containers.Default.Configure(container);
//Throws exception here on this
BaseCalculatorServer server = container.Resolve<BaseCalculatorServer>();

and the Unity.Config file

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

    <!--Unity Configuration-->
    <configSections>
        <section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, 
           Microsoft.Practices.Unity.Configuration"/>
    </configSections>

    <unity>
        <containers>

            <container>

                <types>
                    <type name ="CalculatorServer" type="Calculator.Logic.BaseCalculatorServer, Calculator.Logic" mapTo="Calculator.Logic.CalculateApi, Calculator.Logic"/>
                </types>

            </container>

        </containers>
    </unity>

</configuration>

The Base class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Transactions;
using Microsoft.Practices.Unity;
using Calculator.Logic;

namespace Calculator.Logic
{

    public class BaseCalculatorServer : IDisposable
    {
        public BaseCalculatorServer(){}
        public CalculateDelegate Calculate { get; set; }
        public CalculationHistoryDelegate CalculationHistory { get; set; }


        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or     resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            this.Dispose();
        }
    }
}

The Implementation

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Calculator.Logic;
using System.ServiceModel;
using System.ServiceModel.Configuration;
using Microsoft.Practices.Unity;

namespace Calculator.Logic
{
    public class CalculateApi:BaseCalculatorServer
    {
        public CalculateDelegate Calculate { get; set; }
        public CalculationHistoryDelegate CalculationHistory { get; set; }
    }
}

Yes both base class and implementation are in the same Namespace and thats something design wise that will change once I get this working.
Oh and a more detailed error

Resolution of the dependency failed, type = “Calculator.Logic.BaseCalculatorServer”, name = “”. Exception message is: The current build operation (build key Build Key[Calculator.Logic.BaseCalculatorServer, null]) failed: The value for the property “Calculate” could not be resolved. (Strategy type BuildPlanStrategy, index 3)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:42:30+00:00Added an answer on May 14, 2026 at 4:42 am

    I’m not sure that this would trip Unity up, but what happens if you remove the Calculate and CalculationHistory properties from CalculateApi? These are hiding the members of the base class, which is almost certainly not what you want to be doing.

    I always configure in code, rather than XML, so I’m not sure about this, but maybe try removing the name attribute from your mapping, or passing the proper name when you call Resolve — I’m guessing something like container.Resolve<BaseCalculatorServer>("CalculatorServer"). Unless you are registering multiple implementations, though, I’d remove the name altogether.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following UnitOfWork class in order to get repositories for my
I attempt to use webservice return POCO class generated from entity data model as
Why does this attempt at creating a list of curried functions not work? def
When I attempt to debug a simple program with gdb on cygwin I get
I want to create an instance of an IronPython class from C#, but my
My PHP class constructor appears to not be getting called when the class is
I am trying to use the following code, but it does not work when
I've created a SittingDuck.as class that extends the MovieClip class. When I instantiate SittingDuck
I am trying to instantiate a PDO object like this: $this->pdo['pdo'] = new PDO('mysql:host=127.0.0.1;dbname=mydb;charset=UTF-8',
I can still instantiate by using constructor although in class definition it has been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.