15

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.

David A Gibson
  • 2,013
  • 5
  • 35
  • 60

2 Answers2

26

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.

Be Brave Be Like Ukraine
  • 7,596
  • 3
  • 42
  • 66
9

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

That's right.

If you set it to dynamic, afterwards you can change url of web service (WebService.Url). Details here.

Janis Veinbergs
  • 6,907
  • 5
  • 48
  • 78