<commit_before>---
title: When Configuration Ends
summary: An interface that allows you to hook into the configuration sequence of NServiceBus
tags:
 - life-cycle
related:
 - samples/startup-shutdown-sequence
---

Classes that implement `IWantToRunWhenConfigurationIsComplete` are executed when configuration is completed, right before the bus is created. Use `IWantToRunWhenConfigurationIsComplete` for any tasks that need to be run at the end of bus creation life-cycle. This might include logging diagnostic information about configuration or initialization logic that downstream components depend on.

NOTE: This interface is deprecated in Version 6.

Instances are:

* Located by [assembly scanning](/nservicebus/hosting/assembly-scanning.md) and automatically registered into the [configured container](/nservicebus/containers/) during bus creation. These are registered as Instance Per Call.
* Created as the last step before the bus is created. 
* Created on the same thread that is creating the bus.
* Created by the configured container which means they:
  * Will have dependencies injected.
  * Do not require a default constructor.

NOTE:In Version 3 and Version 4, instances of `IWantToRunWhenConfigurationIsComplete` are registered in the configured container before instances of `INeedInitialization` are created and run. In Version 5 `INeedInitialization` happens first.

Once created `Run(...)` is called on each instance. These calls are made sequentially on the thread that is creating the bus. The order of these calls is determined by the order in which the configured container returns instances.

Exceptions thrown by instances of `IWantToRunWhenConfigurationIsComplete` are unhandled by NServiceBus. These will bubble up to the creator of the bus.

<!-- import lifecycle-iwanttorunwhenconfigurationiscomplete --><commit_msg>adding link to features to IWantToRunWhenConfigurationIsComplete page<commit_after>---
title: When Configuration Ends
summary: An interface that allows you to hook into the configuration sequence of NServiceBus
tags:
 - life-cycle
related:
 - samples/startup-shutdown-sequence
---

Classes that implement `IWantToRunWhenConfigurationIsComplete` are executed when configuration is completed, right before the bus is created. Use `IWantToRunWhenConfigurationIsComplete` for any tasks that need to be run at the end of bus creation life-cycle. This might include logging diagnostic information about configuration or initialization logic that downstream components depend on.

NOTE: This interface is deprecated in Version 6 and has been replaced with [Features](/nservicebus/pipeline/features.md).

Instances are:

* Located by [assembly scanning](/nservicebus/hosting/assembly-scanning.md) and automatically registered into the [configured container](/nservicebus/containers/) during bus creation. These are registered as Instance Per Call.
* Created as the last step before the bus is created.
* Created on the same thread that is creating the bus.
* Created by the configured container which means they:
  * Will have dependencies injected.
  * Do not require a default constructor.

NOTE:In Version 3 and Version 4, instances of `IWantToRunWhenConfigurationIsComplete` are registered in the configured container before instances of `INeedInitialization` are created and run. In Version 5 `INeedInitialization` happens first.

Once created `Run(...)` is called on each instance. These calls are made sequentially on the thread that is creating the bus. The order of these calls is determined by the order in which the configured container returns instances.

Exceptions thrown by instances of `IWantToRunWhenConfigurationIsComplete` are unhandled by NServiceBus. These will bubble up to the creator of the bus.

<!-- import lifecycle-iwanttorunwhenconfigurationiscomplete -->
{'fraction_non_alphanumeric': 0.0502092050209205, 'fraction_numerical': 0.0020920502092050207, 'mean_word_length': 5.189320388349515, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7058423', 'n_tokens_mistral': 898, 'n_tokens_neox': 869, 'n_words': 472}