Reader Level:
Articles

Fixing error: SetConfigurationSettingPublisher needs to be called before FromConfiguration Setting can be used

By Dhananjay Kumar on April 25, 2011
How to use SetConfigurationSettingPublisher needs to be called before FromConfiguration Setting can be used error [Other Solution].
  • 0
  • 0
  • 3408


I would like to thank Neil Mackenzie for this article. His input on the exception below [as commented in my previous post] lead to the content of this post.

SetConfigurationSetting1.gif

In my previous post, I suggested a solution of above exception, and I received a comment from one of my readers that there is an easier way to solve the above exception as well. So I decided to make an article on the other solution as well.
 
At first I won't explain the solution in the previous article; it is harder than the solution provided here or vice versa.

Usually we read a connection string as:

SetConfigurationSetting2.gif

DataConnectionString is name of the connection string in setting of WebRole.

To avoid the above exception read the connection string as:

SetConfigurationSetting3.gif

So essentially,

  1. First get the configuration setting value
  2. Parse that

I hope this post would be useful to you in getting rid of above exception.

COMMENT USING

Trending up