Reputation: 21
I am updating my wcf service reference through SvcUtil.exe. command is as follows:
SvcUtil.exe http://localhost:50886/Service1.svc /n:*,ClassLibrary2.ServiceReference1 /o:Service References\ServiceReference1\Reference.cs /ct:System.Collections.Generic.List`1, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 /config:app.config
And my wcf code is as follows:
==============================================================
namespace WcfService1
{
[ServiceContract]
[ServiceKnownType(typeof(Dictionary<string, string>))]
public interface **IService1**
{
[OperationContract]
string GetData(int value);
// TODO: Add your service operations here
[OperationContract]
string Hello(string value);
}
}
namespace WcfService1
{
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1 : IService1
{
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
public string Hello(string value)
{
return string.Format("You entered: {0}", value);
}
}
}
I am using this service in my class library project which name is ClassLibrary1. When i am updating this service through visual studio then in Reference.cs I got following statement:
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="**ServiceReference1.IService1**")]
public interface IService1
But when m updating service through svcutil then I got following statement:
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="**ClassLibrary2.ServiceReference1.IService1**")]
public interface IService1
The difference is configuration name. I didn't understand which command should i used in svcutil to set configuration name just as ServiceReference1.IService1 ?
Please help.
Upvotes: 1
Views: 1345
Reputation: 11
Just by changing [ServiceContract]
into [ServiceContract(Name="ServiceReference1.IService1", ConfigurationName="ServiceReference1.IService1")]
. See this block post.
Upvotes: 1