none
Remoting RRS feed

  • 问题

  • [RemotingService()]
    public class Package
    {
     Skyline.Remoting.Factory factory = Util.GetRemotingFactory(0);
    
    
     【出错的地方】
     int ret = factory.GetServer().UpDataAmehyst(jsj, msn.avatarName, 2, msn.m_id, msn.avatarID, "开启新包裹");
    }
    
    
    【远端对象】
    /// <summary>
    /// 调用远程对象
    /// </summary>
    /// <param name="sid">当sid=0时表示调用MemberServer</param>
    /// <returns></returns>
    public static Skyline.Remoting.Factory GetRemotingFactory(int sid)
    {
     string url = string.Empty;
     if (sid == 0)
     {
      url = ConfigurationManager.AppSettings["GameSiteRemoting"].ToString() ;
     }
     else
     {
      return null;
     }
     Skyline.Remoting.Factory factory = (Skyline.Remoting.Factory)Activator.GetObject(typeof(Skyline.Remoting.Factory), url);
      return factory;
     }
    
    
    
    【代理类】
    public class Factory:MarshalByRefObject
    {  
     public Skyline.Remoting.server.MemberServer GetServer()
     {
      return new Skyline.Remoting.server.MemberServer();
     }
    }
    
    
    【实现类】
    [Serializable]
    public class MemberServer : MarshalByRefObject
    {
     public int UpDataAmehyst(int Amethyst, string ava_name, int sid, int m_id, int ava_id,string info)
      {
       int ret = 0;
       Money.MoneyDal md = new Skyline.Remoting.Money.MoneyDal();
       //检查是否够支付
       if (md.ValidAmethyst(m_id, Amethyst))
       {
        //扣除金水晶
        md.UpdateAmethyst(m_id, -1*Amethyst);
        //插入美容记录
        AddSalesRecords(sid, m_id, ava_id, Amethyst, ava_name, 1, -1,info);
       }
       else
       {
        //info = "当前账户金水晶余额不足支付";
        ret = 1;
       }
       return ret;
      }
    }
    
    【服务端web.config】
     <system.runtime.remoting>
     <application>
      <service>
      <wellknown mode="Singleton" type="Skyline.Remoting.Factory,Remoting" objectUri="Remoting.soap"></wellknown>
      </service>
      <channels>
      <channel ref="http" />
      <serverProviders>
       <formatter href="binary" />
      </serverProviders>
      </channels>
     </application>
     </system.runtime.remoting>
    
    
    
    【客户端web.config】
    <system.runtime.remoting>
     <application>
      <service>
      <wellknown mode="SingleCall" type="Skyline.Remoting.Factory,Remoting" objectUri="Remoting.soap"></wellknown>
      </service>
      <channels>
      <channel ref="http" />
      <serverProviders>
       <formatter href="binary" />
      </serverProviders>
      </channels>
     </application>
     </system.runtime.remoting>
    
    
    
    【产生错误】
    
    Message : System.Runtime.Remoting.RemotingException: ????????????????????????
    
    StackTrace:
    
    Server stack trace: 
    Exception rethrown at [0]: 
     在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
     在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
     在 Skyline.Remoting.server.MemberServer.UpDataAmehyst(Int32 Amethyst, String ava_name, Int32 sid, Int32 m_id, Int32 ava_id, String info)
     在 Skyline.GameBLL.package.Package.openPackageTab() 位置 F:\work\GameBLLNewUI\package\Package.cs:行号 1202
    
    

    2011年8月19日 1:59

全部回复