The type String cannot be constructed. You must configure the container to supply this value.

If you are getting below error message

(

The type String cannot be constructed. You must configure the container to supply this value.

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.InvalidOperationException: The type String cannot be constructed. You must configure the container to supply this value.

)

while creating WEB Api with Unity framework. It can be fixed by just removing below constructors from ~Areas.HelpPage.Controllers.HelpController


 public HelpController()
 : this(GlobalConfiguration.Configuration)
 {
 }

 public HelpController(HttpConfiguration config)
 {
 Configuration = config;
 }

and then override configuration property as and build you project :)-


protected static HttpConfiguration Configuration
{
  get { return GlobalConfiguration.Configuration; }
}

Programming is Easy…

Advertisements

One thought on “The type String cannot be constructed. You must configure the container to supply this value.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s