0

I want to Use WCF Service in Asp.net I had Add Refrence in Web site.i don't want to Update my Web.Config File.

I want to Handle WCF Service from Code Behind.All Configuration property like

 WSHttpBinding EndpointIdentity Uri ContractDescription 

handle form code behind.

1 Answer 1

1

You need to create an end point using the address and also based on the binding supported by the web service, you can create the Binding and then you will just create the proxy and consume the service.

// Specify an end point address of the service EndpointAddress endpointAdress = new EndpointAddress(serviceUrl); // Create the binding to be used by the service BasicHttpBinding binding1 = new BasicHttpBinding(); //customize the binding configurations like the ones below binding.SendTimeout = TimeSpan.FromMinutes( 1 ); binding.OpenTimeout = TimeSpan.FromMinutes( 1 ); binding.CloseTimeout = TimeSpan.FromMinutes( 1 ); binding.ReceiveTimeout = TimeSpan.FromMinutes( 10 ); //create the client proxy using the specific endpoint and binding you have created YourServiceClient proxy = new YourServiceClient(binding1, endpointAddress); 

Or you can use the ChannelFactory to follow a generic approach which is shown in the How-To guide here

Sign up to request clarification or add additional context in comments.

1 Comment

Where did YourServiceClient come from?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.