wcf .客户端配置,方法调用.

using (IServiceProxy<IPackageService> c = ServiceFactory.GetProxy<IPackageService>())
                    {
                        IList<EcSaleItem> ec = null;
                        var dto = c.Proxy.GetPackage();
                        if (dto != null && dto.Count > 0)
                        {
                            foreach (var item in dto)
                            {
                                drpServiceType.Items.Add(new ListItem(item.Description, item.PackageType.ToString()));
                            }
                        }
                        drpServiceType.Items.Insert(0, new ListItem("所有", "0"));
                    }

 </system.webServer>
 <system.serviceModel>
  <bindings>
   <wsHttpContextBinding>
    <binding closeTimeout="00:05:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false" contextProtectionLevel="Sign">
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
     <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
     <security mode="None">
     </security>
    </binding>
   </wsHttpContextBinding>
   <netTcpBinding>
    <binding closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
     <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
     <security mode="None">
      <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"/>
      <message clientCredentialType="Windows"/>
     </security>
    </binding>
   </netTcpBinding>
  </bindings>
  <client>
   <endpoint address="http://192.168.0.135:8022/EmailService.svc" binding="wsHttpContextBinding" contract="Crb.Services.Contract.IEmailService" name="emailService">
   </endpoint>
            <!--<endpoint address="http://192.168.0.135:8022/PackageService.svc" binding="wsHttpContextBinding" contract="Crb.Services.Contract.IPackageService">-->
             <endpoint address="http://localhost:903/PackageService.svc" binding="wsHttpContextBinding" contract="Crb.Services.Contract.IPackageService">
   </endpoint>
  </client>
 </system.serviceModel>

posted on 2012-11-08 20:00  Yang_zi  阅读(152)  评论(0编辑  收藏  举报