WCF ServiceContract namespace update
I have the following WCF interface:
[ServiceContract]
public interface IUser
{
[OperationContract]
string GetUser();
}
Which I changed to this one:
[ServiceContract(Namespace = "http://user.com")]
public interface IUser
{
[OperationContract]
string GetUser();
}
The target XML Namespace has been changed from default tempuri.org to user.com
开发者_如何转开发This breaks the call of the existing clients because the wsdl is different.
Is there any way to specify this namespace in config file? This will help me to keep the old namespace for the existing clients and be able to upgrade the WS.
A very honest mistake that can be easily missed when deploying a service. Found this thread on msdn forums, which i think might just do the trick.
The idea is very simple, create a new service contract interface (with the correct namespace), inherit it from the existing service contract (with the default namespaces). Make your Service class implement the new service contract and ask the clients to change the endpoint to new service contract.
URL: http://social.msdn.microsoft.com/Forums/en/wcf/thread/2bb09d41-7ee7-4e9d-bea8-95bd318a4247.
精彩评论