环境:
Windows Server 2003 SP2
Microsoft Visual Studio 2005
Castle.DynamicProxy 1.1.5服务端代码:
ProxyGenerator generator = new ProxyGenerator();
object proxy = generator.CreateClassProxy(typeof(ServiceClass),new Interceptor());
IDictionary prop = new Hashtable();
prop["port"] =20002;
IChannel tcpChannel = new TcpChannel(prop, null, null);
ChannelServices.RegisterChannel(tcpChannel, false);
RemotingConfiguration.RegisterWellKnownServiceType(proxy.GetType(), "test", WellKnownObjectMode.Singleton);客户端代码:
object obj = RemotingServices.Connect(typeof(ServiceClass), "tcp://192.168.1.100:20002/test");
ServiceClass sc = obj as ServiceClass;
try
{
    int b = sc.Sum(1, 2);}  //这个地方抛错,异常见下面
catch (Exception ex)
{ }异常:
未能加载文件或程序集“DynamicAssemblyProxyGen, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null”或它的某一个依赖项。系统找不到指定的文件。注:
我已经把所有相关的DLL复制到“客户端”“服务端”目录下了,仍然找不到程序集!

解决方案 »

  1.   


    谢谢,您说的不是很清楚。服务端启动正常,客户端也能正常获得Remoting服务,但是调用Remoting方法的时候出错。
      

  2.   

    <compilation debug="true">
    <assemblies>
    <add assembly="Microsoft.Office.Interop.Word, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"/>
    <add assembly="nunit.framework, Version=2.2.10.0, Culture=neutral, PublicKeyToken=96D09A1EB7F44A77"/>
    </assemblies>
    </compilation>把你所引用的在webconfig里面引用进来。程序集没有找到。肯定是没有引用进来。或者。所引用用到的组件没有安装。
      

  3.   

    程序集都考过来了,而且在服务端调用方法是没有问题的,在不同的AppDomain里调用就有问题了程序集不少
      

  4.   

    DynamicAssemblyProxyGen, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null这个名称有误, 应该是
    [NameSpace.ClassName], [AssemblyName], [Version], [Culture], [PublicKeyToken]你这个DynamicAssemblyProxyGen到底是类名还是Assembly的名字?
      

  5.   

    DynamicProxy相关dll已经复制到客户端了
      

  6.   

    等待做过的人路过。其实大家可以试试,用被代理的类去注册remoting,客户机在调的时候就一定会错。继续等待,继续UP
      

  7.   

    你在注册类型的时候,服务器端应该直接注册ServiceClass,为什么还要用动态代理类呢。客户端连接时会由Remoting服务自动生成对于的代理类。Remoting的实质就是服务器端创建原始对象,客户端使用代理对象访问服务器的对象。
    RemotingConfiguration.RegisterWellKnownServiceType(typeof(ServiceClass), "test", WellKnownObjectMode.Singleton); 
      

  8.   

    你生成的时候注意顺序,先生成DynamicAssemblyProxyGen的项目,再生成客户端。