none
Activation error occured while trying to get instance of type LogWriter RRS feed

  • Question

  • Hi,

    I'm using EnterpriseLibrary 5.0 in my projects, that I have a library project called MyProject.Logging that using EnterpriseLibrary 5.0 to write log and BizTalk project called MyProject.BT which include the orchestration have call to Logging project to write log, the last one project is window service called MyProject.MyService which call to Logging project to write log too.

    Now I runing the BizTalk project and get the error "

    Service cannot be started. Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type LogWriter, key "" ---> Microsoft.Practices.Unity.ResolutionFailedException: Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter", name = "(none)".

    Exception occurred while: while resolving.

    Exception is: InvalidOperationException - The type LogWriter cannot be constructed. You must configure the container to supply this value.

    -----------------------------------------------

    At the time of the exception, the container was:

     

      Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter,(none)

     ---> System.InvalidOperationException: The type LogWriter cannot be constructed. You must configure the container to supply this value.

       at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.GuardTypeIsNonPrimitive(IBuilderContext context, SelectedConstructor selectedConstructor)

       at Microsoft.Practices.ObjectBuilder2....

    "

    I guess my project cannot call the configuration file event I have created the app.config and entlib.config within the Logging project and copied to BizTalk project and Service project.

    Addition, I runing the MyProject.Myservice without any error, it's means can write log successful.

    Any help please.

    Thanks in advance.

    Saturday, November 28, 2015 8:48 AM

Answers

  • I resolved this issue, to fixing this issue, we need copy the configuration setting from the app.config file to the BizTalk configuration file (BTSNTSvc.exe.config and BTSNTSvc64.exe.config files)
    • Marked as answer by Daniel.Nguyen Sunday, November 29, 2015 7:12 AM
    Sunday, November 29, 2015 7:12 AM

All replies

  • Hi Daniel,

    Thank you for posting in MSDN forum.

    Seems your issue is more related to Enterprise Library, I would suggest you to post this on below forum to get some solution,

    Microsoft Patterns and Practices EntLib


    Thanks,

    If my reply is helpful please mark as Answer or vote as Helpful.

    My blog | Twitter | LinkedIn

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Saturday, November 28, 2015 3:41 PM
    Moderator
  • Thanks Kamlesh Kumar,

    I think that the issue related to BizTalk project cannot read the app.config file instead of Enterprise Library itself because another project (service project) working fine with the same feature (call to Logging project to write log).

    Sunday, November 29, 2015 1:44 AM
  • I resolved this issue, to fixing this issue, we need copy the configuration setting from the app.config file to the BizTalk configuration file (BTSNTSvc.exe.config and BTSNTSvc64.exe.config files)
    • Marked as answer by Daniel.Nguyen Sunday, November 29, 2015 7:12 AM
    Sunday, November 29, 2015 7:12 AM