appSettings versus applicationSettings when adding a web reference.

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hey all,
I normally use the wsdl tool to add my proxy classes but the other day I added a web reference from the visual studio IDE to both a web site and a web application project. I couldnt help notice that the web site added the url to the appSettings section where as the web application project added a whole applicationSettings section group for the url.
Web Site
<appSettings><br/> <add key="localhost.Service" value=" http://localhost/WebService/Service.asmx"/ http://localhost/WebService/Service.asmx"/ ><br/> </appSettings>
Web Application Project Example
<configSections><br/> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" ><br/> <section name="ClassLibrary1.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /><br/> </sectionGroup><br/> </configSections><br/> <applicationSettings><br/> <ClassLibrary1.Properties.Settings><br/> <setting name="ClassLibrary1_localhost_Service" serializeAs="String <br/> <value>http://localhost/WebService/Service.asmx</value><br/> </setting><br/> </ClassLibrary1.Properties.Settings><br/> </applicationSettings>
I understand that the applicationSettings section group fits in the with .NET class library model. However, the appSettings section fits in with the WebSite Administration Tool and IIS > ASP.NET > Edit Configuration > Application Settings functionality. Clearly it would be hard to fit complex types available to applicationSettings models into these config tools but I wondered, as did my peers, why Microsoft chose to use two seperate implementations of web references across web sites and web apps? Can anybody shed any light on this and which is considered best practice going forward.
Thanks,
Arthur

View the full article
 
Back
Top