none
关于The requested upgrade is not supported by错误 RRS feed

  • 问题

  • 以前的时候没有这样的问题。

    今天调用出现了问题。

    先贴客户端代码。

     

     

          string str_WCFHostUrl = HostHelper.GetHostUrl(typeof(Client).Namespace);<br/>
    
          if (string.IsNullOrEmpty(str_WCFHostUrl))<br/>
    
          {<br/>
    
            return;<br/>
    
          }<br/>
    
    <br/>
    
          NetTcpBinding ntb_Binding = new NetTcpBinding { TransferMode = TransferMode.Buffered };<br/>
    
          ntb_Binding.Security.Mode = SecurityMode.Transport;<br/>
    
          ntb_Binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.None;<br/>
    
          ntb_Binding.Security.Transport.ProtectionLevel = ProtectionLevel.EncryptAndSign;<br/>
    
          ntb_Binding.TransactionFlow = false;<br/>
    
          ntb_Binding.TransactionProtocol = TransactionProtocol.OleTransactions;<br/>
    
          ntb_Binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;<br/>
    
          ntb_Binding.CloseTimeout = new TimeSpan(0, 1, 0);<br/>
    
          ntb_Binding.OpenTimeout = new TimeSpan(0, 1, 0);<br/>
    
          ntb_Binding.ReceiveTimeout = new TimeSpan(0, 1, 0);<br/>
    
          ntb_Binding.SendTimeout = new TimeSpan(0, 1, 0);<br/>
    
          ntb_Binding.ListenBacklog = 100;<br/>
    
          ntb_Binding.MaxBufferPoolSize = 524288;<br/>
    
          ntb_Binding.MaxBufferSize = 8000000;<br/>
    
          ntb_Binding.MaxConnections = 100;<br/>
    
          ntb_Binding.MaxReceivedMessageSize = 80000000;<br/>
    
          ntb_Binding.ReliableSession.Ordered = true;<br/>
    
          ntb_Binding.ReliableSession.InactivityTimeout = new TimeSpan(0, 10, 0);<br/>
    
          ntb_Binding.ReliableSession.Enabled = false;<br/>
    
          ntb_Binding.ReaderQuotas.MaxDepth = 32;<br/>
    
          ntb_Binding.ReaderQuotas.MaxStringContentLength = 28192;<br/>
    
          ntb_Binding.ReaderQuotas.MaxArrayLength = 56384;<br/>
    
          ntb_Binding.ReaderQuotas.MaxBytesPerRead = 8096;<br/>
    
          ntb_Binding.ReaderQuotas.MaxNameTableCharCount = 56384;<br/>
    
          EndpointIdentity epi_Dns = EndpointIdentity.CreateDnsIdentity("WCFService");<br/>
    
          AddressHeaderCollection ahc_Header = new AddressHeaderCollection();<br/>
    
          EndpointAddress epa_Endpoint = new EndpointAddress(new Uri(str_WCFHostUrl), epi_Dns, ahc_Header);<br/>
    
          wcf_Client = new TradeLogisticsCompanyClient(ntb_Binding, epa_Endpoint);<br/>
    
          wcf_Client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;<br/>
    
          wcf_Client.Open();
    

     

    这是客户端建立连接的代码。没有使用config的方式。都是使用代码的方式来操作的。以前这个代码没有任何问题。可以正常使用。

     

    然后再来服务器端的。

     

     

     <system.serviceModel><br/>
    
      <services><br/>
    
       <!--IM Start--><br/>
    
       <service behaviorConfiguration="Service1Behavior" name="SevenPrincess.Server.WCF.Service.Service.IM.CallDetail"><br/>
    
        <endpoint address="net.tcp://localhost:600/IM/CallDetail" binding="netTcpBinding"<br/>
    
             bindingConfiguration="netTcpBindingConfigration" contract="SevenPrincess.Server.WCF.Service.Interface.IM.ICallDetail"/><br/>
    
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/><br/>
    
        <host><br/>
    
         <baseAddresses><br/>
    
          <add baseAddress="net.tcp://localhost:600/IM/CallDetail"/><br/>
    
         </baseAddresses><br/>
    
        </host><br/>
    
       </service><br/>
    
       <service behaviorConfiguration="Service1Behavior" name="SevenPrincess.Server.WCF.Service.Service.IM.CallType"><br/>
    
        <endpoint address="net.tcp://localhost:600/IM/CallType" binding="netTcpBinding"<br/>
    
             bindingConfiguration="netTcpBindingConfigration" contract="SevenPrincess.Server.WCF.Service.Interface.IM.ICallType"/><br/>
    
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/><br/>
    
        <host><br/>
    
         <baseAddresses><br/>
    
          <add baseAddress="net.tcp://localhost:600/IM/CallType"/><br/>
    
         </baseAddresses><br/>
    
        </host><br/>
    
       </service><br/>
    
       <service behaviorConfiguration="Service1Behavior" name="SevenPrincess.Server.WCF.Service.Service.IM.ChatLog"><br/>
    
        <endpoint address="net.tcp://localhost:600/IM/ChatLog" binding="netTcpBinding"<br/>
    
             bindingConfiguration="netTcpBindingConfigration" contract="SevenPrincess.Server.WCF.Service.Interface.IM.IChatLog"/><br/>
    
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/><br/>
    
        <host><br/>
    
         <baseAddresses><br/>
    
          <add baseAddress="net.tcp://localhost:600/IM/ChatLog"/><br/>
    
         </baseAddresses><br/>
    
        </host><br/>
    
       </service><br/>
    
       <service behaviorConfiguration="Service1Behavior" name="SevenPrincess.Server.WCF.Service.Service.IM.IM"><br/>
    
        <endpoint address="net.tcp://localhost:600/IM/IM" binding="netTcpBinding"<br/>
    
             bindingConfiguration="netTcpBindingConfigration" contract="SevenPrincess.Server.WCF.Service.Interface.IM.IIM"/><br/>
    
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/><br/>
    
        <host><br/>
    
         <baseAddresses><br/>
    
          <add baseAddress="net.tcp://localhost:600/IM/IM"/><br/>
    
         </baseAddresses><br/>
    
        </host><br/>
    
       </service><br/>
    
       <service behaviorConfiguration="Service1Behavior" name="SevenPrincess.Server.WCF.Service.Service.IM.IMAccount"><br/>
    
        <endpoint address="net.tcp://localhost:600/IM/IMAccount" binding="netTcpBinding"<br/>
    
             bindingConfiguration="netTcpBindingConfigration" contract="SevenPrincess.Server.WCF.Service.Interface.IM.IIMAccount"/><br/>
    
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/><br/>
    
        <host><br/>
    
         <baseAddresses><br/>
    
          <add baseAddress="net.tcp://localhost:600/IM/IMAccount"/><br/>
    
         </baseAddresses><br/>
    
        </host><br/>
    
       </service><br/>
    
       <service behaviorConfiguration="Service2Behavior" name="SevenPrincess.Server.WCF.Service.Service.IM.IMConnect"><br/>
    
        <endpoint address="net.tcp://localhost:600/IM/IMConnect" binding="netTcpBinding"<br/>
    
             bindingConfiguration="netTcpConnectConfigration" contract="SevenPrincess.Server.WCF.Service.Interface.IM.IIMConnect"/><br/>
    
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/><br/>
    
        <host><br/>
    
         <baseAddresses><br/>
    
          <add baseAddress="net.tcp://localhost:600/IM/IMConnect/"/><br/>
    
         </baseAddresses><br/>
    
        </host><br/>
    
       </service><br/>
    
       <service behaviorConfiguration="Service1Behavior" name="SevenPrincess.Server.WCF.Service.Service.IM.Responsivity"><br/>
    
        <endpoint address="net.tcp://localhost:600/IM/Responsivity" binding="netTcpBinding"<br/>
    
             bindingConfiguration="netTcpBindingConfigration" contract="SevenPrincess.Server.WCF.Service.Interface.IM.IResponsivity"/><br/>
    
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/><br/>
    
        <host><br/>
    
         <baseAddresses><br/>
    
          <add baseAddress="net.tcp://localhost:600/IM/Responsivity"/><br/>
    
         </baseAddresses><br/>
    
        </host><br/>
    
       </service><br/>
    
       <!--IM End--><br/>
    
      </services><br/>
    
      <behaviors><br/>
    
       <serviceBehaviors><br/>
    
        <behavior name="Service1Behavior"><br/>
    
         <serviceMetadata httpGetEnabled="False"/><br/>
    
         <serviceDebug includeExceptionDetailInFaults="False"/><br/>
    
         <serviceThrottling maxConcurrentCalls="1000" maxConcurrentSessions="1000" maxConcurrentInstances="1000"/><br/>
    
         <serviceCredentials><br/>
    
          <serviceCertificate storeName="My" findValue="WCFService" storeLocation="LocalMachine" x509FindType="FindBySubjectName"/><br/>
    
         </serviceCredentials><br/>
    
        </behavior><br/>
    
        <behavior name="Service2Behavior"><br/>
    
         <serviceMetadata httpGetEnabled="false"/><br/>
    
         <serviceDebug includeExceptionDetailInFaults="False"/><br/>
    
         <serviceThrottling maxConcurrentCalls="1000" maxConcurrentSessions="1000" maxConcurrentInstances="1000"/><br/>
    
         <serviceCredentials><br/>
    
          <serviceCertificate storeName="My" findValue="WCFService" storeLocation="LocalMachine" x509FindType="FindBySubjectName"/><br/>
    
         </serviceCredentials><br/>
    
        </behavior><br/>
    
       </serviceBehaviors><br/>
    
      </behaviors><br/>
    
      <bindings><br/>
    
       <netTcpBinding><br/>
    
        <binding name="netTcpBindingConfigration"><br/>
    
         <security mode="Transport"><br/>
    
          <transport clientCredentialType="None"/><br/>
    
         </security><br/>
    
        </binding><br/>
    
        <binding name="netTcpConnectConfigration"><br/>
    
         <reliableSession inactivityTimeout="01:10:00" enabled="true"/><br/>
    
         <security mode="Transport"><br/>
    
          <transport clientCredentialType="None"/><br/>
    
         </security><br/>
    
        </binding><br/>
    
       </netTcpBinding><br/>
    
      </bindings><br/>
    
     </system.serviceModel>
    

     

    这是服务器端的config配置信息。

    以前的时候是只有一个服务实例,现在因为项目变化了。变成很多实例了。其实唯一变化也就在这里。其他的变化不大的。

    谁能帮我看看为什么会出现问题呢?

    2010年8月30日 13:25

答案

  • 和客户端的配置 肯定不一样啊
     服务端binding的配置
     很多都使用的是默认的设置
     2个一样的配置
     如果你客户端代码
     显示设置了 这些属性 而服务端是默认的
     一旦有一个不匹配就可能导致错误啊
     你看看你服务的配置
     就是关于binding的

     

    你可以简化 客户端的binding的设置代码,实例化的时候和服务端的binding一样


    Frank Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
     

    老徐的网站】:http://www.frankxulei.com/

    老徐的博客】:http://www.cnblogs.com/frank_xl/

    微软WCF中文技术论坛
    微软WCF英文技术论坛

    • 已标记为答案 Blood.Xia 2010年8月30日 15:22
    2010年8月30日 13:48
    版主