惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
Recent Announcements
Recent Announcements
IT之家
IT之家
人人都是产品经理
人人都是产品经理
G
Google Developers Blog
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
大猫的无限游戏
大猫的无限游戏
U
Unit 42
罗磊的独立博客
博客园 - Franky
WordPress大学
WordPress大学
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
M
MIT News - Artificial intelligence
SecWiki News
SecWiki News
V
Vulnerabilities – Threatpost
P
Privacy International News Feed
P
Palo Alto Networks Blog
F
Fortinet All Blogs
P
Proofpoint News Feed
博客园 - 叶小钗
C
CERT Recently Published Vulnerability Notes
T
Tor Project blog
Spread Privacy
Spread Privacy
S
Securelist
C
Cisco Blogs
I
Intezer
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Cyberwarzone
Cyberwarzone
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Engineering at Meta
Engineering at Meta
S
Schneier on Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
GbyAI
GbyAI
T
Troy Hunt's Blog
T
Threatpost
博客园 - 司徒正美
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
AWS News Blog
AWS News Blog
T
The Blog of Author Tim Ferriss
G
GRAHAM CLULEY
N
Netflix TechBlog - Medium
酷 壳 – CoolShell
酷 壳 – CoolShell
Google DeepMind News
Google DeepMind News
Know Your Adversary
Know Your Adversary
S
SegmentFault 最新的问题

博客园 - 阿修罗一平

IIS部署WCF出现的各种问题汇总 Infragistics控件的工具栏注册 NUnit的使用中可能遇到的问题 Linq备忘 Nihibernate的重要知识点 Devexpress使用记录 使用List数据集合,利用DevExpress.XtraReports开发Master-Detail报表 PDA访问WCF PDA(WinCE)项目开发中遇到的问题及解决方法总结 Grid控件绑定bindingSource后在新增行时设置Cell的初始值 “BindingSource绑定单个实体对象后在代码中赋值无效和无法显示”的解决方法 sqlservier2005转成sqlserver2000中出现的问题(WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]) 项目考虑因素及解决方案(.net) 设计模式在工作中的应用(三) 设计模式在工作中的应用(二) 设计模式在工作中的应用(一) NHibernate示例 关于Remoting服务启动和停止的简单总结 将公司系统从SqlServer 2K移植到Oracle 10g中的简要总结
Remoting服务集成到IIS的简单总结
阿修罗一平 · 2007-08-27 · via 博客园 - 阿修罗一平

    因为项目的Remoting服务有可能集成到IIS中,所以下午利用一些时间,做了一个例子,实现了需要的功能,代码就凑合一下。
现在把这个过程总结一下:

1.       创建远程对象类Class1,它实现一个接口Interface1public class Class1 : MarshalByRefObject, Interface1
    {
        #region Interface1 Members
        public string SendMessage(string msg)
        {
            return "Hello " + msg;
        }
        #endregion
       public override object InitializeLifetimeService()
        {
            return null;
        }
    }

    public interface Interface1
   {
        string SendMessage(string msg);
    }

2.      建立虚拟目录



根据自己的需要选择选项,我是偷懒,不想受什么限制。生活中已经受到很多限制,难道在自己的机器上做开发还要收到限制吗?

F:\IISTest目录下建立Bin目录,然后将包含远程对象类的组件IISClassLibrary1.dll放入bin目录中。并创建Web.config

<system.runtime.remoting>
    <application>
      <service>
        <wellknownmode="Singleton"
                   type="IISClassLibrary1.Class1,IISClassLibrary1"
                   objectUri="Class1.soap"/>
      </service>
     <channels>
        <channel
           name="MyChannel"
           priority="100"
           ref="http"
            />
      </channels>
    </application>
 </system.runtime.remoting>

3.      建立客户端

使用配置文件,创建App.config配置文件

<?
xmlversion="1.0"encoding="utf-8" ?>
<configuration>
 <system.runtime.remoting>
    <application>
     <client>
       <wellknowntype="IISClassLibrary1.Class1,IISClassLibrary1"
                   url="http://localhost/IISTest/Class1.soap"/>

      </client>
    </application>
 </system.runtime.remoting>
</configuration>


            //客户端调用
            string
filename = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;

            RemotingConfiguration.Configure(filename,false);

            IISClassLibrary1.Interface1 mgr = new IISClassLibrary1.Class1();           

            string retValue = mgr.SendMessage("yiping");

            获得所需要的结果:Hello yiping

    用“Hello yiping"给自己打气,努力做到“不抛弃,不放弃”,希望生活一天比一天美好。