最近正在學習Remoting,碰到一些問題﹐是關于Remoting事件的問題﹐在網上查了好久也沒有得到解決﹐借這里的人氣﹐求個解答。
大壞蛋的blog中提及的事件處理﹐我按照他的思路﹐按步就班﹐但我想使用配置文件來實現﹐可不知怎么回事﹐怎么也不能成功﹐無奈之下﹐只好改為代碼實現﹐說也真神﹐代碼實現很快就得到想要的結果﹐當然﹐post出來的東西﹐如果不能成功﹐還不被人家丟雞蛋砸死﹐呵呵... 所以我想﹐可能就是配置文件的原因﹐在此我將配置文件貼出來﹐求各位指點一二﹕
服務端配置:
<?
xml version="1.0" encoding="utf-8"
?>
< configuration >
< system .runtime.remoting >
< application >
< channels >
< serverProviders >
< formatter ref ="binary" typeFilterLevel ="Full" />
</ serverProviders >
< clientProviders >
< formatter ref ="binary" />
</ clientProviders >
< channel ref ="http" port ="1080" />
</ channels >
< service >
< wellknown mode ="Singleton" type ="MyLibrary.MsgBoard,MyLibrary" objectUri ="Message" />
</ service >
</ application >
</ system.runtime.remoting >
</ configuration >
客戶端配置文件﹕
< configuration >
< system .runtime.remoting >
< application >
< channels >
< serverProviders >
< formatter ref ="binary" typeFilterLevel ="Full" />
</ serverProviders >
< clientProviders >
< formatter ref ="binary" />
</ clientProviders >
< channel ref ="http" port ="1080" />
</ channels >
< service >
< wellknown mode ="Singleton" type ="MyLibrary.MsgBoard,MyLibrary" objectUri ="Message" />
</ service >
</ application >
</ system.runtime.remoting >
</ configuration >
<?
xml version="1.0" encoding="utf-8"
?>
< configuration >
< system .runtime.remoting >
< application >
< channels >
< serverProviders >
< formatter ref ="binary" typeFilterLevel ="Full" />
</ serverProviders >
< clientProviders >
< formatter ref ="binary" />
</ clientProviders >
< channel ref ="http" port ="0" />
</ channels >
< client >
< wellknown type ="MyLibrary.MsgBoard,MyLibrary" url ="http://localhost:1080/Message.soap" />
</ client >
</ application >
</ system.runtime.remoting >
</ configuration >
運行結果如下﹕
< configuration >
< system .runtime.remoting >
< application >
< channels >
< serverProviders >
< formatter ref ="binary" typeFilterLevel ="Full" />
</ serverProviders >
< clientProviders >
< formatter ref ="binary" />
</ clientProviders >
< channel ref ="http" port ="0" />
</ channels >
< client >
< wellknown type ="MyLibrary.MsgBoard,MyLibrary" url ="http://localhost:1080/Message.soap" />
</ client >
</ application >
</ system.runtime.remoting >
</ configuration >
源文件可以在這里取得
源文件中如果注釋掉
#define
UseConfigurationFile
這一句話﹐是可以得出想要的結果的。也就是大壞蛋的實現方法是可以得到想要的結果的。
但為什么用配置文件就得不出正確的結果呢?