Web Reference URL Behavior

Posted on July 25, 2005 at 15:55

So I created a Windows Service (based on this) that is designed for one purpose: to call a Web Service on my ASP.net application every 2 minutes that will perform certain jobs (like sending emails, other maintenance). In the config file for the service there is an appsetting labeled <add key=”Namespace.WebServiceName” value=”http://WebServiceAddress/JobRun.asmx”/>.

According to this article, by changing the key for this appsetting before installation of the Windows Service, the Windows Service would call the Web Service identified by the key. So it was written.

In the the Solution Manager in VS 2003, there is a Property under the Web Service called “URL Behavior”. This can be set either to “Static” or to “Dynamic” (see here for more official info).

  • When set to Static, the URL that is entered for this Web Service when the Web Service is first referenced in VS is the url that will always be used.
  • When set to Dynamic, the Web Service will always use the URL located in the config file | appsettings.

Obviously, in order for the Windows Service to function properly (ie: call the Web Service that is indicated in the Config file), the URL Behavior property of the Web Reference must be set to Static. Unfortunately for me, during my editing of this file and changing of the Web Reference, I forgot to set my Web Reference from its default behavior of Static to its correct behavior of Dynamic. Thus wasting many of my hours and killing many of my brain cells. Don’t let it happen to you.

  1. 2 Responses to “Web Reference URL Behavior”

  2. 1) Yasir Atabani on Jun 12, 2008 | Reply

    “Obviously, in order for the Windows Service to function properly”

    this is not true, web service implementations vary , and this is a very useful property, that you can use to alter the web service URL.

  3. 2) Chris on Aug 12, 2008 | Reply

    Usualy, you just spawn a worker thread from ASP.net to do that sort of work for you. That / those thread(s) will persist as long as ASP.net does, and can then be easily managed from within your ASP.net app.

    Using a windows service is one more thing to maintain, and one more thing to break.

    Community Server is a great example of code to look at that uses worker threads from an ASP.net instance.

Post a Comment

Powered by WP Hashcash