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 8035669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:22:27+00:00 2026-06-05T02:22:27+00:00

Wish you all good mood! Please help me with Unity. My App.config file contains:

  • 0

Wish you all good mood!
Please help me with Unity.

My App.config file contains:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration"/>
  </configSections>
  <system.diagnostics>
    <sources>
      <source name="TraceTest" switchName="SourceSwitch"
        switchType="System.Diagnostics.SourceSwitch" >
        <listeners>
          <add name="console" />
          <remove name ="Default" />
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="SourceSwitch" value="All" />
    </switches>
    <sharedListeners>
      <add name="console"
        type="System.Diagnostics.ConsoleTraceListener"
        initializeData="false"/>
    </sharedListeners>
    <trace autoflush="true" indentsize="4">
      <listeners>
        <add name="console" />
      </listeners>
    </trace>
  </system.diagnostics>
  <unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
    <assembly name="ContextDownloader"/>
    <namespace name="ContextDownloader.Log"/>
    <namespace name="System.Diagnostics"/>
    <sectionExtension type="Microsoft.Practices.Unity.InterceptionExtension.Configuration.InterceptionConfigurationExtension, 
Microsoft.Practices.Unity.Interception.Configuration"/>
    <container>
      <extension type="Interception"/>
      <register type="ILogWorker" mapTo="FileLogWorker">
        <interceptor type="InterfaceInterceptor"/>
        <interceptionBehavior type="TraceBehavior"/>
      </register>
      <register type="TraceSource" name="interception">
        <constructor>
          <param name="name" type="System.String" value="TraceTest" />
        </constructor>
      </register>
      <register type="TraceBehavior">
        <constructor>
          <param name="source" dependencyName="interception" />
        </constructor>
      </register>
    </container>
  </unity>
</configuration>

I load configuration from App.config in my code:

var fileMap = new ExeConfigurationFileMap { ExeConfigFilename = "App.config" };
Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
var unitySection = (UnityConfigurationSection)configuration.GetSection("unity");
var container = new UnityContainer();

So it throws exception

Unhandled Exception: System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for unity: The type name or alias Microsoft.Practices.Unity.InterceptionExtension.Configuration.InterceptionConfigu
rationExtension, Microsoft.Practices.Unity.Interception.Configuration could not be resolved. Please check your configuration file and verify this type name.

in line var unitySection = (UnityConfigurationSection)configuration.GetSection("unity");. How I can load Microsoft.Practices.Unity.Interception.Configuration assembly?

More details about application. I have console application and library. I have just call one method in my console application and then all logic are in library.

Thanks for your answer about copy this Microsoft.Practices.Unity.InterceptionExtension.Configuration.dll to output library. Can you help me to load system.diagnostic section too?

  • 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-06-05T02:22:29+00:00Added an answer on June 5, 2026 at 2:22 am

    Did you verify that the Microsoft.Practices.Unity.Interception.dll and Microsoft.Practices.Unity.Interception.Configuration.dll are located in your app base folder or that they are registered in the GAC?

    Did you check that your App.config file is still named App.config after compilation and not renamed to something like MyApp.Foo.dll.config?

    Could you please post the complete config file. The above snippet works perfectly on my machine so I guess there is something else missing.

    Btw: If you want to use the default App.config or Web.config anyway you can drop the ExeConfigurationFileMap and directly call ConfigurationManager.GetSection("unity")


    Update

    So you have an application which is not a console app (e.g. WinForms or WPF) and want to write trace output to a console? Then maybe this article can help. It shows how to allocate a console window using native Win32 calls from managed code.

    If you want to use the configuration file that is bundled with the library and independent of the configuration file of your application this article here on StackOverflow might be of interest.

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

Sidebar

Related Questions

How you doing today? Wish you all good. By the way, here is my
Good afternoon all, I have a Java applet that I wish to embed on
Good afternoon, I wish to have a script that will look for all files
Good morning all, happy thursday morning. I wish I could have done this by
I wish to replace all the link urls in some HTML with a number
I have a load of signatures I wish to compare (all in ISF -
Given the following list of descending unique numbers (3,2,1) I wish to generate all
I have the following beans Task, ServerDetails and ApplicationDetails. I wish to retrieve all
I wish to write the list of all parameter values used for the current
I wish to get a list of all strings that are used in a

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.