Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make work ConfigSection?
    primarykey
    data
    text
    <p>I'm facing a serious issue here, I'm trying to configure a new section for my web app and after trying 10 thousands different things I think it's better if I make my own post.</p> <p><strong>Here is my code :</strong></p> <pre class="lang-xml prettyprint-override"><code>&lt;configSections&gt; &lt;section name="EmailConfigurationSection" type="ServiceEmail.Helper.EmailConfigurationSection, ServiceEmail.Helper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/&gt; &lt;/configSections&gt; &lt;EmailConfigurationSection isDebug="true" smtpAddress="***" smtpLogin="***" smtpPassword="***" smtpPort="***" emailPersonForTest="***@***.lu"/&gt; </code></pre> <pre class="lang-cs prettyprint-override"><code>public class EmailConfigurationSection : ConfigurationSection { private static readonly EmailConfigurationSection settings = ConfigurationManager.GetSection("EmailConfigurationSection") as EmailConfigurationSection; public static EmailConfigurationSection EmailConfiguration { get { return settings; } } [ConfigurationProperty("isDebug", DefaultValue = "false", IsRequired = false)] public Boolean IsDebug { get { return (Boolean) this["isDebug"]; } set { this["isDebug"] = value; } } } </code></pre> <p>... I have here all the property defined in my web.config</p> <p>Everytime I tried to access a property, I got a <code>NullReferenceException</code> on EmailConfiguration</p> <p>I already set my web.conf for it to be copied in the output directory.</p> <p>After using NameCollectionValue I get that :</p> <pre><code>Une exception a été levée par l'initialiseur de type pour 'ServiceEmail.Helper.EmailConfigurationSection'. --System.Configuration.ConfigurationErrorsException: Une erreur s'est produite lors de la création du gestionnaire de section de configuration pour EmailConfigurationSection : Impossible de charger le fichier ou l'assembly 'ServiceEmail.Helper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ou une de ses dépendances. Le fichier spécifié est introuvable. (C:\inetpub\wwwroot\Service_Mails\web.config line 8) ---&gt; System.IO.FileNotFoundException: Impossible de charger le fichier ou l'assembly 'ServiceEmail.Helper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ou une de ses dépendances. Le fichier spécifié est introuvable. à System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost host, String typeString, Boolean throwOnError) à System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord) à System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord) à System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord) à System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean&amp; isRootDeclaredHere) --- Fin de la trace de la pile d'exception interne --- à System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean&amp; isRootDeclaredHere) à System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object&amp; result, Object&amp; resultRuntimeObject) à System.Configuration.BaseConfigurationRecord.GetSection(String configKey) à System.Configuration.ConfigurationManager.GetSection(String sectionName) à ServiceEmail.Helper.EmailConfigurationSection..cctor() dans C:\Users\***\documents\visual studio 2010\Projects\ServiceEmail\ServiceEmail\Helper\EmailConfigurationSection.cs:ligne 14 --ServiceEmail </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload