I have the same ASP.NET WebService deployed 3 times under 3 different URI's configured to look at 3 different databases environments.
I have a Class Library that uses the WebService using a Web Reference.
Every time I want to compile the Class Library to a different environment I have to change the Web Reference by hand to the appropriate URL.
Although not complicated this is a pain for creating Live versions of the Class Library and slows down our deployment process (A quick note there are multiple .asmx files but this example describes only 1 so that it is easier to understand).
What I am trying to do is have a DataServices class that returns an Interface for the WebService. In the Class Library all 3 Web References exist and I instantiate the correct one via simple configuration in the Class Library itself then return the right Web Service as an Interface.
This all seems straightforward to me but it isn't working as the Interface doesn't appear to work though Web Services. Can someone please confirm this for me or tell me what I'm doing wrong?
Unable to cast object of type 'Company.Project.Classes.MyWebServiceLive.MyWebService' to type 'Company.Project.Interfaces.IMyWebService'.
Thanks
EDIT The WebService is of course implementing the Interface, which is all I thought I'd need to do...