Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello there,
C#
[ServiceContract(Namespace = "http://some url/")]
		public interface ISample
		{

			[OperationContract]

			double Add(double i, double j);

			[OperationContract]

			double Sub(double i, double j);

			[OperationContract]

			Complex AddComplexNo(Complex i, Complex j);

			[OperationContract]

			Complex SubComplexNo(Complex i, Complex j);

		}

		[DataContract(Namespace = "http://some url/")]
		public class Complex
		{
			[DataMember]
			public int Real { get; set; }

			[DataMember]
			public int Imaginary { get; set; }

		}

How to assign a value to the NameSpace using web.config app settings key ?


I mean read the Namespace url from web.config and set to the Namespace property here.

I tried using a static class, but it expects the url value to be hard coded.

Can I define namespace url in web.config itself without defining here..?

The same service is used for multiple locations, so , the namespace value has to be assigned differently.

Thank you in advance.
Posted
Updated 18-Nov-13 4:44am
v2

1 solution

 
Share this answer
 
Comments
[no name] 18-Nov-13 23:39pm    
Thank you, for ur answer. I have already tried it. But I want to read namespace value from web.config, which is not allowed in this case, a compilation error is thrown if a configurable value is assigned to it from web.config. Please suggest any other solution....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900