通过远程调用解决异地数据传输的问题已经OK了。经过测试,在同一台计算机上运行服务器和客户端,远程调用也是没有问题的。经过测试,在Web应用中调用远程服务也没有问题。现在我的调用失败了。应用调用流程:应用程序---->预览网站--->WEB 服 务 器--->远程调用对象--->远程服务--->数据处理
             预览结果<---响应请求数据<---获取响应数据<---数据响应<---处理结果其中的Web服务器是自己写的,也就是公开的MS的轻量级的代码,但在请求数据的时候拦住了,没有直接使用.NET的WEB解析程序,而是调用一个远程服务,由远程服务来处理数据并返回结果后响应预览请求。进行跟踪,发现这个错误是在开始调用的时候就出现了,也就是远程调用对象有错误。
下面是跟踪到的错误信息(日期时间是我加进去的):RemotingExceptioin 2005-3-9 16:02:37
Message:System.ArgumentNullException: h0g( DispatchChannelSink d9 e
f2!f e
e:ee d;;d=f6f/c 
ef0e
: requestMsg
   at System.Runtime.Remoting.Channels.DispatchChannelSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)
   at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)
   at System.Runtime.Remoting.Channels.Http.HttpServerTransportSink.ServiceRequest(Object state)
   at System.Runtime.Remoting.Channels.SocketHandler.ProcessRequestNow()
2005-3-9 16:02:37
HelpLink: 2005-3-9 16:02:37
InnerException: 2005-3-9 16:02:37
Source:mscorlib 2005-3-9 16:02:37
StackTrace:
Server stack trace: 
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 Superdata.SDNet.Common.Remote.ICmnCallFun.RmtFunCall(Int32 iMsgCmd, CallingMsg sendMsg, CallingMsg& rtnMsg)
   at Superdata.SDNet.Common.WebSvr.RmtWebSvrCaller.GetPageData(String strPagePath, String strQueryString, Int32 iPort, String strChannelName) 2005-3-9 16:02:37
TargetSite:Void HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessage) 2005-3-9 16:02:37

解决方案 »

  1.   

    奇怪的是,这段异常信息居然是乱码:utf-8、unicode、default、GB2312都不正确。
      

  2.   

    does the channel on the client side match that of the server?
      

  3.   

    回复人: saucer(思归) ( ) 信誉:331  2005-03-10 13:05:00  得分: 0  
     
     
       does the channel on the client side match that of the server?
      
     
    应该是匹配的。因为在WEB启动的时候调用都没有问题,就是页面请求的时候这样。
      

  4.   

    相关代码:internal class Request : SimpleWorkerRequest
    {
      internal void Process(int iPort,string strChannelName)
      {    ParseRequestLine();
        _conn.WriteEntireResponseFromBytes(200,Connection.MakeContentTypeHeader(this.GetUriPath()), RmtWebSvrCaller.GetPageData(this.GetUriPath(),this.GetQueryString(),iPort,strChannelName),false);
        return;
       }
    }RmtWebSvrCaller:/// <summary>
    /// 获取远程 Web 页面数据
    /// </summary>
    /// <param name="strPagePath">页面路径信息,不包含主机和端口内容</param>
    /// <param name="strQueryString">GET 数据字符串</param>
    /// <returns>字节编码的页面数据,如果长度为 0 则失败</returns>
    internal static byte[] GetPageData(string strPagePath, string strQueryString,int iPort,string strChannelName)
    {
    CallingMsg sendMsg = new CallingMsg();
    ArrayList arr = new ArrayList();
    arr.Add(strPagePath);
    arr.Add(strQueryString);
    sendMsg.objData = arr;
    int iport = iPort;
    string strchannelname = strChannelName;
    CallingMsg rtnMsg = new CallingMsg();
    try
    {
    m_RemoteServer=(ICmnCallFun)Activator.GetObject(typeof(ICmnCallFun),string.Format("http://localhost:{0}/{1}.Soap",iport,strchannelname));
    if(m_RemoteServer.RmtFunCall(3,sendMsg,ref rtnMsg))
    {
    Host.LogAccessInfo("请求地址2:"+strPagePath);
    if(rtnMsg != null && rtnMsg.bytesMsg != null)
    return rtnMsg.bytesMsg;
    Host.LogAccessInfo("请求地址2:"+strPagePath);
    }
    }
    catch(Exception err)
    {
    return System.Text.Encoding.Default.GetBytes(err.ToString()+"<br><br>"+iport+",,"+strchannelname);
    }
    return new byte[0];
    }
      

  5.   

    >>>http://localhost:{0}/{1}.Soapshow the channel part of your web.config
      

  6.   

    是WINFORM应用。一个建站工具创建企业网站,企业网站数据打包存储,因此在预览网站的时候没有办法解决数据问题,便使用了MS的轻量WEB SERVER代码。在系统中不存在真正的WEB应用,预览时访问WEB SERVER,SERVER在处理REQUEST数据的时候拦截,不调用MS的后续代码,而是调用远程服务来获得相应的服务数据。我看准备下给你一份单独的代码。
      

  7.   

    问题解决,又是小朋友犯的错误:进程之间数据共享的问题。当访问WEB进程的时候,已经跟开始启动WEB服务器进程不同了。