RE: Dynamic Web Service URL Reference



{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fswiss\fprq2\fcharset0 Verdana;}}
\viewkind4\uc1\pard\lang2052\f0\fs20 Hi David,
\par
\par In .NET 2.0, the webservice URL is still stored in your configuration file (web.config or app.config). If you open the generated "Reference.cs", you will see code like following:
\par
\par public Service() \{
\par this.Url = global::ConsoleApplication1.Properties.Settings.Default.ConsoleApplication1_localhost_Service;
\par
\par
\par It's now using a strong typed Setting named "ConsoleApplication1_localhost_service" which can be modified using the Setting Designer in Visual Studio 2005:
\par
\par http://msdn2.microsoft.com/en-us/library/aa730869(vs.80).aspx
\par
\par If you open the App.config, you will see:
\par
\par <configSections>
\par <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
\par <section name="ConsoleApplication1.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
\par </sectionGroup>
\par </configSections>
\par <applicationSettings>
\par <ConsoleApplication1.Properties.Settings>
\par <setting name="ConsoleApplication1_localhost_Service" serializeAs="String">
\par <value>http://localhost:4799/WebService1/Service.asmx</value>
\par </setting>
\par </ConsoleApplication1.Properties.Settings>
\par </applicationSettings>
\par
\par
\par This is called Application Settings:
\par
\par http://msdn2.microsoft.com/en-us/library/a65txexh(VS.80).aspx
\par
\par To modify this config using Msbuild, please refer to following article:
\par
\par http://geekswithblogs.net/paulwhitblog/archive/2006/04/11/74844.aspx
\par
\par It has some msbuild task to let you easily update the config file when building the project.
\par
\par Hope this helps.
\par
\par
\par Sincerely,
\par Walter Wang (wawang@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
\par Microsoft Online Community Support
\par
\par ==================================================
\par Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notifications. If you are using Outlook Express, please make sure you clear the check box "Tools/Options/Read: Get 300 headers at a time" to see your reply promptly.
\par
\par Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx.
\par ==================================================
\par
\par This posting is provided "AS IS" with no warranties, and confers no rights.
\par }

Relevant Pages

  • Re: WSE 3.0 settings
    ... I think WSE should apply settings on fly. ... should look for the settings in the calling assembly config file (Calling ... I want to use third party DLL (Or I have to develop a DLL to be used in ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Re: appsetting in class doesnt work
    ... In 2003 I could easily change the config file settings from inside the app, ... Dim cnfg As System.Configuration.Configuration ...
    (microsoft.public.dotnet.languages.vb)
  • re: Dynamic Documentation of Web.Config
    ... I need to document the web.config settings of all the asp.net apps that my company builds/maintains. ... The results will write to the page and link each key/value tag to its corresponding MSDN documentation ... will accessing a web config file with either a streamReader object or xmlReader object to read the file's contents effect the performance or stability of a web app? ... Scenario: I need to document the web.config settings of all the asp.net apps that my company builds/maintains and I would like to code a solution that presents the settings of each app dynamically. ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)
  • Re: Attach and Access config file for Class Library
    ... The way this is *supposed* to work, the app.config would hold the settings ... including the settings for the dll. ... I don't use the config file API. ... and have your app simply load the xml file from the ...
    (microsoft.public.dotnet.framework)
  • Re: appsetting in class doesnt work
    ... the solution and I am trying to obtain settings from the app.config file of ... config file uses the XML format standard of Vs2005. ... Dim s As String = My.Setting.TestSetting ... how do you retrieve the TestSetting value ...
    (microsoft.public.dotnet.languages.vb)