What is the correct pattern or method for developing a Silverlight application (which is the Silverlight project and Web Application in a single solution)? I mean, how do you add the Service Reference if the localhost port number will be constantly changing?
Thanks.
If you select the web project in the Solution Explorer, you can change a property in the Properties tool window that will stop the port from changing. The property is called ‘Use dynamic ports’ and you want to set it to false so that the port remains static.
You can also specify the port number in these settings.
Note that this is not in the project’s property pages, but in the Properties tool window (which is probably why it’s so hard to find – took me quite some time to work this one out myself).
Update
To switch between deployment and development, I tend to specify two SOAP bindings and then use
#ifdef DEBUGto switch the binding of my SOAP client based on the type of build. The DEBUG build points to the development services, and the RELEASE build points to the deployed services.So, my ClientConfig is something like:
I create instances of the SOAP client like this: