URL Behaviour in a Visual Studio Web Reference

David A Gibson picture David A Gibson · Oct 7, 2009 · Viewed 13.3k times · Source

Please can some one explain exactly what the URL Behaviour (Static or Dynamic) property for a Web Reference in Visual Studio is for.

I believe it affects where the URl for the Web Service is stored but I don't have a clear understanding.

Answer

bytebuster picture bytebuster · May 25, 2012

Here's a bit more complete answer.

Dynamic automatically adds a setting that specifies Web Service URL. Yes, it can be managed through app.config, but the setting must reside in a specific place of app.config under <applicationSettings>.

Static makes the proxy's constructor to initialize Url property to its original value.

So if you have your own URL handling (e.g. the URL is retrieved from the database or resides in another section of app.config), URL Behaviour must be Static and changed later in your custom code.