最近小弟在学remote。
1,关于SAO
小弟用了两种激活方式。一为singleton还有一为singlecall这里小弟想问如果小弟激活singleton,不管它的生命周期。将会出现什么后果?
是不是从生成的时候就一直存在?只是我觉得因为一直都存在且只存在一个对象。所以不管它是不是也可以?
2。现在有一报错怎么也解决不了。提示为:由于安全限制.无法访问类型 System.Runtime.Remoting.ObjRef
小弟用的是配置文件,因为用的2003.net开发环境,经查资料说注册信道的时候必须要typeFileterLevel="Full"格式,可是小弟写到配置文件中。依然报错。这会让小弟郁闷了!
server端:
<configuration>
  <system.runtime.remoting>
    <application>
  
      <channels>
        <channel ref="tcp" port="1234" />
<serverProviders>
<provider ref="wsdl" />
<formatter ref="binary" typeFileterLevel="Full" />
<formatter1 ref="soap" typeFileterLevel="Full" />
</serverProviders>
      </channels>
      <service>
        <wellknown mode="Singleton" type="Price.BusinessFacade.PrivilegeRemote_Singleton, Price.BusinessFacade" objectUri="Privilege_Singleton.rem"  />
        <wellknown mode="Singleton" type="Price.BusinessFacade.RemoteInit, Price.BusinessFacade" objectUri="Init.rem" />
        <wellknown mode="SingleCall" type="Price.BusinessFacade.PrivilegeSystem, Price.BusinessFacade" objectUri="PrivilegeSystem.rem" />
        <wellknown mode="SingleCall" type="Price.BusinessFacade.TMSSystem, Price.BusinessFacade" objectUri="TMS.rem" />
        <wellknown mode="Singleton" type="Price.BusinessFacade.WMSSystem, Price.BusinessFacade" objectUri="WMS.rem" />
        <wellknown mode="Singleton" type="Price.BusinessFacade.LMSSystem, Price.BusinessFacade" objectUri="LMS.rem" />
        <wellknown mode="Singleton" type="Price.BusinessFacade.PMSystem, Price.BusinessFacade" objectUri="BaseData.rem" />
      </service>
    </application>
  </system.runtime.remoting>
</configuration>
client端:
<client>

<!-- This entry only works with the RemotingHelper class -->
        <wellknown type="General.IRemoteObject_Privilege_Singleton, General"  
                   url="tcp://localhost:1234/Privilege_Singleton.rem" />
                   
        <wellknown type="General.IRemoteObject_PrivilegeSystem, General"  
                   url="tcp://localhost:1234/PrivilegeSystem.rem" />
                   
        <wellknown type="General.IRemoteObject_TMS, General"  
                   url="tcp://localhost:1234/TMS.rem" />
                   
        <wellknown type="General.IRemoteObject_WMS, General"  
                   url="tcp://localhost:1234/WMS.rem" />
                   
        <wellknown type="General.IRemoteObject_LMS, General"  
                   url="tcp://localhost:1234/LMS.rem" />
                   
        <wellknown type="General.IRemoteInit_Singleton, General"  
                   url="tcp://localhost:1234/Init.rem" />
                   
        <wellknown type="General.IRemoteObject_BaseData, General"  
                   url="tcp://localhost:1234/BaseData.rem" />
                   
      </client>
3,小弟想用sqlhelper class,来做remote,想改为可以调用存储过程的?请问有什么好的方法吗?
或者有其他更好的sqlhelper类来代替这数据访问类?nhibernate?
可不可以给我一个好的data block?万分感谢!
暂时就这三个,还请思归大哥不要吝啬帮小弟一大忙。大恩不言谢![email protected]

解决方案 »

  1.   

    这问题很难吗?
    1.对于对象生存期请大哥们在帮我确认下,如果我规定服务端singleton对象A的生存期为1分钟,一个client端连上来生成了之后。一分钟后A释放。这时第二个client端又连上来了,或者第一个client端2.重新调用到远程对象A的方法,请问这时是不是又重新生成呢??还是??
    经过实验发现是sqlparameter[]传不进去。请问谁有好的方法?我不想用sqlscript拼接的方式哦。这样要根据后台sp来对应写,不是很好。
    3.我现在没发现哪个datablock是远程的,这里我想是不是所有的c/s结构的remoting应用都是c端直接本地连接到s端的数据库呢?期望大哥们指点。
    万分感谢!
      

  2.   

    不建议用singleton模式,多用户同时操作时会有问题,
           <channel ref="tcp" port="1234" />
    <serverProviders>
    <formatter ref="binary" />
    </serverProviders>
          </channels>
    这样就可以了,好象不能同时走binary和soap.
    你说的数据访问类,在小型的项目可以用持久层之类的东西,但是如果多数据表和大数据量不太适用,传输就用datatable.
    一般remoting发布的只是接口层,你还要做一个业务层,再联到数据层。
      

  3.   

    谢谢上面的仁兄。
    singleton模式多用户同时操作?举个具体的实例?可不可以用lock来控制呢?
    持久层是什么东西?有没有一个例子?强烈感谢?
    remoting 发布的是接口层,按业务层的代码不是放到服务端的吗?
    那业务层再去访问数据层的时候。不也在服务端执行的吗?
    难道这个时候又能调用到客户端的数据访问层?这是什么模式?cao吗?
      

  4.   

    remoting 用得不多,呵呵看看soap ,web service吧