Metadata is Locked
Why aren't the changes that I programmatically make to the service contract reflected in the downloaded metadata?
This is another common question around the confusion between the design time behavior and run time behavior of the system. The configuration of the system can be altered during design time. During run time it cannot. At the lower levels, design time and run time are very formally separated. There are a small number of distinguished methods, which as an effect of being called switch the object from design time mode to run time mode.
At the service level, design time and run time are separated by a murky boundary. Starting the service is a single action that switches many objects from design time to run time, and the order of the switchover can be difficult to guess. At one point, the metadata representing the various contracts is switched from design time to run time and can no longer be altered. At another point, your code may be invoked in the process of switching a separate component from design time to run time. There's clearly a dependency on the order of execution because your code needs to be run first in order for the changes to become visible. The most straightforward way of dealing with this problem is to move the code that changes the contract so that it executes before the contract switches to run time. You can be absolutely guaranteed that things will be visible if you modify them before any attempt to start the service.
Next time: Don't Run as Administrator
Comments
- Anonymous
September 04, 2007
Why does a service call require creating multiple connections when using message security? Several common