我在远程对象上定义了接口 ,在服务端进行了实现 。
      经过编译后,  在本地建立虚拟目录。配置webconfig ,建立Bin文件夹copy服务dll 
      现在建立客户端时候,说无法连接远程服务,  谁有这方面经验帮我解决下      以下是部分代码,也只是做个例子
服务端:
       public class Server : MarshalByRefObject, users
    {
        static void Main(string[] args)
        {
            IChannel tcp = new TcpChannel(8502);
            ChannelServices.RegisterChannel(tcp, false);            // 注册http通道
            IChannel httpChnl = new HttpChannel(8505);
            ChannelServices.RegisterChannel(httpChnl, false);            Type t = typeof(users);
            RemotingConfiguration.RegisterWellKnownServiceType(t, "UsersProvider", WellKnownObjectMode.SingleCall);
        }
        #region users 成员        bool users.Validate(User xuxl)
        {
            DataSet ds = sqlhelper.UserSet();
            bool xx = false;
            foreach (DataRow Dr in ds.Tables[0].Rows)
            {
                if (Dr["PUserName"].ToString() == xuxl.UserName && Dr["PUserID"].ToString() == xuxl.Pwd)
                {
                    xx = true;
                }
            }
            return xx;
        }
        #endregion    }客户端  User xuxl = new User();
            xuxl.UserName = "xuxl";
            xuxl.Pwd = "123";
            xuxl.IP = "192.168.111.29";
            xuxl.Address = "hb";
            string url = "http://localhost:8505/UsersProvider";
            bool yy = false;
            users test = (users)Activator.GetObject(typeof(users), url);
            yy = test.Validate(xuxl);
            Console.WriteLine(yy.ToString());
            Console.ReadKey();
       刚从书上接触的 ,希望大家能多给点宝贵建议 。。
    

解决方案 »

  1.   

    无法连接服务器 是不是IIS匿名访问
    没有权限??
      

  2.   

    没有啊  IIS上面配置的可以匿名访问 
       我就在本地测试
      

  3.   

    服务端一般都是做成windows服务,第一次看到放iis上的。
      

  4.   

    就是用的默认网站的虚拟目录 ,IIS不是启动状态吗 ? 还是需要做什么操作  
      

  5.   

    网上面不是说可以放到IIS上吗   ? 难道还要加个win 服务?
      

  6.   

    Remoting服务不是可以集成到IIS的吗?
      

  7.   

    发到IIS上   http://localhost/IISTest/Server.soap?wsdl
      访问返回结果
    System.Runtime.Remoting.RemotingException: 无法加载类型“REM.Server, REM”。
       在 System.Runtime.Remoting.RemotingConfigHandler.RemotingConfigInfo.LoadType(String typeName, String assemblyName)
       在 System.Runtime.Remoting.RemotingConfigHandler.RemotingConfigInfo.GetServerTypeForUri(String URI)
       在 System.Runtime.Remoting.RemotingConfigHandler.GetServerTypeForUri(String URI)
       在 System.Runtime.Remoting.RemotingServices.GetServerTypeForUri(String URI)
       在 System.Runtime.Remoting.Channels.Http.HttpRemotingHandler.CanServiceRequest(HttpContext context)
       在 System.Runtime.Remoting.Channels.Http.HttpRemotingHandler.InternalProcessRequest(HttpContext context)这是什么意思