当前位置: 代码迷 >> Web Service >> remoting小疑点
  详细解决方案

remoting小疑点

热度:365   发布时间:2012-02-23 22:01:36.0
remoting小问题
初学remoting,问题弱智 各位大虾别笑话我
用工厂模式利用Wellknown达到客户端激活效果的例子。一切正常,但当我把原先硬编码在程序中的一些信息写在配置文件中去却报错:不支持所指定的方法。
程序还是原来的,只是把注册信道的代码注释了,写入配置文件中,检查了半天配置文件,未发现错误,如下:
服务端:
XML code

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.runtime.remoting>
    <application>
      <channels>
        <channel ref="http" port="1234">
          <serverProviders>
            <formatter ref="binary" typeFilterLevel="Full" />
            <formatter ref="soap" typeFilterLevel="Full" />
          </serverProviders>
        </channel>
      </channels>
      <service>
        <wellknown mode="Singleton" type="MyRemotingObj.MyRemotingFactory,MyRemotingObj" objectUri="Factory.soap" />
      </service>
    </application>
  </system.runtime.remoting>
</configuration>


客户端:
XML code

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.runtime.remoting>
    <application>
      <channels>
        <channel ref="http" port="1235">
          <clientProviders>
            <formatter ref="binary" typeFilterLevel="Full" />
            <formatter ref="soap" typeFilterLevel="Full" />
          </clientProviders>
        </channel>
      </channels>
      <client>
        <wellknown type="IRemotingObject.IRmotingFactory,IRemotingObject" url="http://localhost:1234/Factory.soap" />
      </client>
    </application>
  </system.runtime.remoting>
</configuration>


不知是何缘故?

------解决方案--------------------
我知道哪里错了
XML code

<clientProviders>
            <formatter ref="binary" typeFilterLevel="Full" />
            <formatter ref="soap" typeFilterLevel="Full" />
          </clientProviders>

------解决方案--------------------
<formatter> 包含要插入信道接收调用链中的格式化程序接收。可在 <clientProviders> 实例元素中出现一次。
<provider> 包含要插入信道接收调用链中的信道接收。可在 <clientProviders> 实例元素中出现一次或多次。

客户端发送的IMessage只能有一种格式,要么你用binary要么用soap,不能2个都用上.

http://www.msdn.net/library/chs/default.asp?url=/library/CHS/cpgenref/html/gnconclientprovidersinstance.asp
  相关解决方案