现在的项目是一个C/S的程序,其访问流程是这样的:
Client Û WCF Server Û DB Server
系统中的WCF访问数据使用了wsHttpBinding和basicHttpBinding两种协议。其中wsHttpBinding的服务中用到了Session。
Config文件中是这样配置的:
配置文件
<endpoint address="http://ap106vm06/AegisService/AegisService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IAegisService"
contract="AegisService.IAegisService" name="WSHttpBinding_IAegisService">
<identity>
<dns value="Aegis" />
</identity>
</endpoint>
<endpoint address="http://ap106vm06/AegisService/AegisServiceBasic.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAegisServiceBasic"
contract="AegisServiceBasic.IAegisServiceBasic" name="BasicHttpBinding_IAegisServiceBasic">
<identity>
<dns value="Aegis" />
</identity>
</endpoint>
一切正常。
但是现在客户要求所有的访问要经过一台SSO服务器(Hp公司的IceWall服务器),即数据访问流程变成了如下:
Client Û SSO Server(Ice Wall) Û WCF Server Û DB Server
于是我把配置文件改成如下形式:
修改后的配置文件
<endpoint address="http://172.22.1.13/fw/dfw/GU019/AegisService/AegisService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IAegisService"
contract="AegisService.IAegisService" name="WSHttpBinding_IAegisService">
<identity>
<dns value="Aegis" />
</identity>
</endpoint>
<endpoint address="http://172.22.1.13/fw/dfw/GU019/AegisService/AegisServiceBasic.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAegisServiceBasic"
contract="AegisServiceBasic.IAegisServiceBasic" name="BasicHttpBinding_IAegisServiceBasic">
<identity>
<dns value="Aegis" />
</identity>
</endpoint>
理论上,访问http://172.22.1.13/fw/dfw/GU019/XXX和访问http://ap106vm06/XXX是等价的,而且在浏览器中
http://172.22.1.13/fw/dfw/GU019/AegisService/AegisService.svc能够正常访问。
程序运行的时候,basicHttpBinding的服务能正常执行,但是wsHttpBinding的服务却会抛出异常。
异常信息是:
程序找不到EndPoint http://172.22.1.13/fw/dfw/GU019/AegisService/AegisService.svc,这可能是因为Address
或Soap Action没有设置正确。
Call Stack如下:
异常堆栈
Server stack trace:
at System.ServiceModel.Channels.ClientReliableSession.ProcessCreateSequenceResponse(Message response, DateTime start)
at System.ServiceModel.Channels.ClientReliableSession.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ReliableRequestSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Nichicom.Wel.Mother.WelOperator.AegisService.IAegisService.ExecuteScalar(Boolean IsInTransaction, String strConnToken, WelSqlCommandStruct welSqlCommands)
at Nichicom.Wel.Mother.WelOperator.AegisService.AegisServiceClient.ExecuteScalar(Boolean IsInTransaction, String strConnToken, WelSqlCommandStruct welSqlCommands) in C:\WelMotherAegis\01_AegisSource\Common\WelOperator\Service References\AegisService\Reference.cs:line 456
at Nichicom.Wel.Mother.WelOperator.ServiceAccess.ExecuteScalar(Boolean IsInTransaction, WelSqlCommand welSqlCommands) in C:\WelMotherAegis\01_AegisSource\Common\WelOperator\WelDBOperator\ServiceAccess.cs:line 197
不太理解为什么basicHttpBinding可以但是wsHttpBinding不行,看错误好像是在ReliableRequestSessionChannel打开的过程中出错,
难道WCF的Session需要建立持久通道,在我印象中,WCF应该是通过Soap消息头上的Session ID支持Session的。
也许我的理解有偏差,大家有什么建议吗?希望不吝赐教,也可以一起讨论一下,多谢。

BK网络学院主要内容:平面设计教程,网站开发在线教程,网页制作教程,服务器教程,网络编程,数据库教程等。