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

每个问题 35分, 单位断网, 明天(星期六)结贴,分不够另外新建帖子送分

1 “System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(System.Runtime.Remoting.Channels.IChannel)”
已过时:“Use System.Runtime.Remoting.ChannelServices.RegisterChannel(IChannel chnl, bool ensureSecurity) instead.”
D:\MY_PROJECT\C#2005_PRJ\ObjectServer\RegeditClass\Program.cs 26 13 RegeditClass

2、由于安全限制,无法访问类型 System.Runtime.Remoting.ObjRef。
未处理SerializationException

3、指定的 SOAPAction 无效: "http://schemas.microsoft.com/clr/nsassem/ObjectServer.ISpatialDataManager/VPFTool#sub"
未处理RemotingException

客户端代码:
            ChannelServices.RegisterChannel(new HttpChannel());

            string uri = "http://192.168.137.1:8828/GisClassLibary/SpatialDataManager";
            ObjectServer.ISpatialDataManager obj = null;
            obj = (ObjectServer.ISpatialDataManager)Activator.GetObject(typeof(ObjectServer.ISpatialDataManager), uri);

   obj.loadMap1(ref axMapControl);   // 调用该方法产生以上问题2
            //obj.loadMap2();
   MessageBox.Show(obj.sub(1, 2).ToString());// 调用该方法产生以上问题3


编译服务器端的宿主程序,产生告警: 问题1
宿主程序代码:
    RemotingConfiguration.ApplicationName = "GisClassLibary";

   WellKnownServiceTypeEntry SpatialDataManager = new WellKnownServiceTypeEntry(typeof(ObjectServer.SpatialDataManager), "ObjectServer", WellKnownObjectMode.Singleton);
    RemotingConfiguration.RegisterWellKnownServiceType(SpatialDataManager);

   ChannelServices.RegisterChannel(new HttpChannel(8828));
   ChannelServices.RegisterChannel(new TcpChannel(8829));
   Console.ReadLine();
--------------------编程问答-------------------- 1、应该只是警告,并不妨碍你用。如果非要消除这个警告,可以使用新的RegisterChannel方法,方法保存的路径已经告诉你了在 System.Runtime.Remoting.ChannelServices.RegisterChannel(IChannel chnl, bool ensureSecurity)。
2、需要用到unsafe。
3、需要看到完整的异常信息,最好用trycatch捕捉一下打印出来。 --------------------编程问答-------------------- 你好
第二个问题 是运行期错误,修改编译选项有用吗?

--------------------编程问答-------------------- 第二个问题是 在客户端remoting服务器断时产生错误, --------------------编程问答-------------------- up --------------------编程问答-------------------- 1“System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(System.Runtime.Remoting.Channels.IChannel)”
已过时:“Use System.Runtime.Remoting.ChannelServices.RegisterChannel(IChannel chnl, bool ensureSecurity) instead.”
D:\MY_PROJECT\C#2005_PRJ\ObjectServer\RegeditClass\Program.cs2613RegeditClass
——————————————————

可能需要手工引进新的组件。然后用新的方法解决就OK了。跟2005里用appsetting()方法差不多的情况。 --------------------编程问答-------------------- 应该只是警告,并不妨碍你用。如果非要消除这个警告,可以使用新的RegisterChannel方法,方法保存的路径已经告诉你了在 System.Runtime.Remoting.ChannelServices.RegisterChannel(IChannel chnl, bool ensureSecurity)。

你try一下
--------------------编程问答-------------------- 好像是程序执行的默认用户权限不够. --------------------编程问答-------------------- 我的系统中不存在 System.Runtime.Remoting.ChannelServices 这样的命名空间, 我用的是VS.NET 2005

其他两个问题都解决了:
问题二: 我传入remoting的参数是一个没有被序列化的对象
问题三: 是由于远程组件的程序集设置不对

另外大家帮忙看看这个问题 : http://community.csdn.net/Expert/topic/5420/5420180.xml?temp=.9574549
--------------------编程问答-------------------- 学习中~~
友情UP --------------------编程问答-------------------- 3月份的贴子? --------------------编程问答-------------------- 支持搂主,收藏
补充:.NET技术 ,  组件/控件开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,