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

推荐订阅源

Jina AI
Jina AI
C
Cisco Blogs
博客园 - Franky
有赞技术团队
有赞技术团队
雷峰网
雷峰网
博客园 - 聂微东
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
NISL@THU
NISL@THU
P
Palo Alto Networks Blog
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
Hugging Face - Blog
Hugging Face - Blog
宝玉的分享
宝玉的分享
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Threat Research - Cisco Blogs
T
Tailwind CSS Blog
T
Threatpost
D
Darknet – Hacking Tools, Hacker News & Cyber Security
W
WeLiveSecurity
大猫的无限游戏
大猫的无限游戏
V
Visual Studio Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
SegmentFault 最新的问题
博客园 - 【当耐特】
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
Arctic Wolf
PCI Perspectives
PCI Perspectives
S
Secure Thoughts
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
L
LINUX DO - 最新话题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
The Last Watchdog
The Last Watchdog
人人都是产品经理
人人都是产品经理
罗磊的独立博客
S
Schneier on Security
腾讯CDC
Google DeepMind News
Google DeepMind News
小众软件
小众软件
量子位
N
News and Events Feed by Topic
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Hacker News: Ask HN
Hacker News: Ask HN
V
V2EX

博客园 - 阿修罗一平

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"给自己打气,努力做到“不抛弃,不放弃”,希望生活一天比一天美好。