AppSettings 아니고 appSettings 소분자 이다.
1 2 3 4 5 6 7 8 9 10 |
<?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="smtp" value="cd.smtp.com"/> <add key="share" value="\\cdserver.com\share\"/> <add key="UserCount" value="2"/> </appSettings> </configuration> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Configuration; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string smtpserver = ConfigurationManager.AppSettings["smtp"]; string sharelocation = ConfigurationManager.AppSettings["share"]; string usercount = ConfigurationManager.AppSettings["UserCount"]; Console.WriteLine(smtpserver); Console.WriteLine(sharelocation); Console.WriteLine(usercount); Console.Read(); } } } |