title: Batch file can't read ApplicationSettings file
body: <p>I have a console .Net application that's executed via a batch file passing one parameter. I'm working on migrating this setup to a different server and for some reason I'm getting errors on the new server seeming to indicate that ApplicationSettings file can not be read. The setups on both servers look the same to me, permissions look OK also. Both servers are Win 2008. Any suggestions are appreciated.</p>
  
  <p>Here are the details:</p>
  
  <p><strong>Batch file:</strong></p>
  
  <pre><code>auto-batch-processes.exe 2
  </code></pre>
  
  <p><strong>auto-batch-processes.exe.config:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;appSettings file="Config\ApplicationSettings.config" /&gt;
    &lt;connectionStrings configSource="Config\ConnectionStrings.config" /&gt;
    &lt;startup&gt;
  </code></pre>
  
  <p>.............</p>
  
  <p><strong>Config\ApplicationSettings.config</strong></p>
  
  <pre><code>&lt;appSettings&gt;
    &lt;add key="log4net.Internal.Debug" value="true"/&gt;
    &lt;add key="Environment" value="LIVE" /&gt;
  ......
    &lt;add key="Email" value="blabla@blabla.com"/&gt;
  ......
  &lt;/appSettings &gt;
  </code></pre>
  
  <p>Upon execution of the batch file, I'm getting the following error</p>
  
  <pre><code>D:\Apps\Auto-Batch-Processes&gt;auto-batch-processes.exe 3
  
  Unhandled Exception: System.ArgumentNullException: Value cannot be null.
  Parameter name: address
     at System.Net.Mail.MailAddress..ctor(String address, String displayName, Enco
  ding displayNameEncoding)
     at auto_batch_processes.Managers.NotificationManager..ctor() in c:\Workspace\
  MSI\Auto Batch Processes\auto-batch-processes\Managers\NotificationManager.cs:li
  ne 25
     at auto_batch_processes.AbpBase..ctor() in c:\Workspace\MSI\Auto Batch Proces
  ses\auto-batch-processes\AbpBase.cs:line 18
     at auto_batch_processes.JobProcessor..ctor() in c:\Workspace\MSI\Auto Batch P
  rocesses\auto-batch-processes\JobProcessor.cs:line 12
     at auto_batch_processes.Program.Main(String[] jobs) in c:\Workspace\MSI\Auto
  Batch Processes\auto-batch-processes\Program.cs:line 21
  </code></pre>
  
  <p>And here the application code snippets where it presumable blows up:</p>
  
  <pre><code>public NotificationManager()
          {
            _fromAddress = new MailAddress(System.Configuration.ConfigurationManager.AppSettings["Email"]);
              _environment = System.Configuration.ConfigurationManager.AppSettings["Environment"];
  </code></pre>
  
  <p>...........</p>
  
  <pre><code>public MailAddress(string address, string displayName, Encoding displayNameEncoding) {
              if (address == null){
                  throw new ArgumentNullException("address"); 
              }
              if (address == String.Empty){ 
                  throw new ArgumentException(SR.GetString(SR.net_emptystringcall,"address"), "address"); 
              }
  </code></pre>