मुझे लिखने वाले क्लाइंट एप्लिकेशन के लिए app.config को तैनात किए बिना मैंने डब्लूसीएफ सेवा से कनेक्ट करने की आवश्यकता है। हालांकि, मुझे कोड में क्लाइंट साइड से चीजों को सेट अप करने का तरीका जानने का प्रयास करने में बहुत मुश्किल समय हो रहा है। यह जहां तक मैंने प्राप्त किया है ... क्या किसी के पास कोई विचार है जो मुझे काम करने के लिए करने की ज़रूरत है? मैं वास्तव में इसकी सराहना करता हूं।कोड में wsDualHttp बाइंडिंग का उपयोग कर डब्लूसीएफ क्लाइंट कैसे सेट अप करें?
इस कोड को मैं अब तक मिल गया है है:
String baseAddress = "http://localhost/CommService";
WSDualHttpBinding binding = new WSDualHttpBinding();
binding.Name = "WSDualHttpBinding_ICommService";
binding.ClientBaseAddress = new Uri(baseAddress);
binding.ReliableSession.Ordered = true;
binding.ReliableSession.InactivityTimeout = new TimeSpan(0, 10, 0);
binding.ReceiveTimeout = new TimeSpan(0, 10, 0);
binding.SendTimeout = new TimeSpan(0, 0, 5);
InstanceContext context = new InstanceContext(this);
client = new CommServiceClient(context, "WSDualHttpBinding_ICommService");
client.Endpoint.Binding = binding;
और यह मेरे मुवक्किल को एप्लिकेशन की app.config है:
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_ICommService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:00:05"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/CommService/"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_ICommService"
contract="Services.ICommService" name="WSDualHttpBinding_ICommService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
यह पूरी तरह से काम करता है, धन्यवाद! यह मुझे पागल कर रहा था, हाहा। –