当前位置:编程学习 > C#/ASP.NET >>

WCF 服务器和客户端总连接不上啊! 求助

WCF
服务端和客户端分别在2台机器上!!!!!!!!!!!!!!


服务器的配置文件中的主要
<endpoint address="http://192.168.10.141:54321/AlertDetailService/Service" binding="wsHttpBinding" contract="AlertDetailService.IContract" />
......
       <wsHttpBinding>
        <binding name='wshttp'>
          <security mode='None'/>
        </binding>
      </wsHttpBinding> 

安全模式为空 


客户端的配置文件

           <client>
            <endpoint address="http://192.168.10.141:54321/AlertDetailService/Service"
                binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IContract"
                contract="IContract" name="WSHttpBinding_IContract">
                <identity>
                    <userPrincipalName value="SERVER-F2A8B5A7\Administrator" />
                </identity>
            </endpoint>
          ........


当客户端调取服务端数据的时候 出现了错误

objClient.getServiceContent();


error display -->

The message could not be processed. This is most likely because the action 'http://192.168.10.141:54321/AlertDetailService/Service/IContract/serviceInfo' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.

这个问题怎么解决啊!!!!!!!!请教了 
--------------------编程问答-------------------- ding ding  --------------------编程问答--------------------   我也遇到这个问题,哪位高手指点一下! --------------------编程问答-------------------- 服务器配置文件endpoint和binding配置没有对应上:
<endpoint address="http://192.168.10.141:54321/AlertDetailService/Service" binding="wsHttpBinding" contract="AlertDetailService.IContract" />
......
  <wsHttpBinding>
  <binding name='wshttp'>
  <security mode='None'/>
  </binding>
  </wsHttpBinding>  
应该改为:

<endpoint address="http://192.168.10.141:54321/AlertDetailService/Service" binding="wsHttpBinding" bindingConfiguration="wshttp" contract="AlertDetailService.IContract" />
......
  <wsHttpBinding>
  <binding name='wshttp'>
  <security mode='None'/>
  </binding>
  </wsHttpBinding>  

--------------------编程问答-------------------- 修改之后需要在客户端重新引用一下。然后再测试。 --------------------编程问答-------------------- 客户端的安全模式要与服务端的一致,security=none --------------------编程问答-------------------- 新人帮顶啊  不会 --------------------编程问答-------------------- 上面改为Security=None可以,

另外一种办法是:wsHttp默认是用windows集成验证的。可以在客户端加上认证信息 --------------------编程问答-------------------- there is a mismatch between bindings --------------------编程问答-------------------- 把安全验证去掉吧 开始的时候先这么做 等熟悉后 试着添加 密码验证 或者加证书验证
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,