Yazdığım istemci uygulaması için bir app.config dağıtmak zorunda kalmadan yazdığım bir WCF hizmetine bağlanma ihtiyacım var. Ancak, istemciden koddaki şeyleri nasıl ayarlayacağımı anlamaya çalışmak için çok zor bir zaman geçirdim. Bu aldığım kadarıyla ... işe almak için ne yapmam gerektiği konusunda herhangi bir fikri olan var mı? Bunu gerçekten takdir ediyorum. Kodda wsDualHttpBinding kullanarak bir WCF istemcisi nasıl ayarlanır?
Bu
şimdiye kadar var kodudur: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;
Ve bu müvekkilim uygulamanın app.config geçerli:
<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>
Bu mükemmel çalıştı, teşekkürler! Beni delirtiyordu haha. –