ARTICLE

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

Posted by Dhananjay Kumar Articles | Windows Azure April 25, 2011
How to use SetConfigurationSettingPublisher needs to be called before FromConfiguration Setting can be used error [Other Solution].
Reader Level:


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.

Login to add your contents and source code to this article
comments
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.