542179528 发表于 2015-8-16 09:08:44

.Net Remoting(6)用IIS发布

这次跟大家讨论的的是用IIS服务Remoting程序,用IIS服务做宿主.首先跟大家说下这个车DEMO是vs2003做的,因为我们公司还主要使用这个,请大家原谅.
首先:建立一个对象ClassLibrary3,做查询数据库使用,再建立一个remoting程序,建立一个叫Web.config的配置文件,代码如下:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.runtime.remoting>
      <application>
            <service>
                <wellknown type="ClassLibrary3.HelloServer, ClassLibrary3"
                  objectUri="HelloServer.soap"
                  mode="SingleCall" />
            </service>   
            <channels>
                <channel ref="http"/>
            </channels>   
      </application>
    </system.runtime.remoting>
</configuration>

在这里我们不用在设置channels,因为IIS已经默认是80端口.
之后在客户端程序建立一个程序,在他的Web.config里加入以下代码:


    <system.runtime.remoting>
    <application>
      <client>
      <!--<wellknown type="HelloServer, General" url="http://localhost:8090/SayHello" />-->
      <wellknown type="ClassLibrary3.HelloServer, ClassLibrary3" url="http://192.168.1.101/remoting/HelloServer.soap" />
      </client>
      <channels>
      <channel ref="http" useDefaultCredentials="true" />
      </channels>
      <!--<channels>
      <channel ref="http" port="0"></channel>
      </channels>-->
    </application>
</system.runtime.remoting>
完整代码下载
页: [1]
查看完整版本: .Net Remoting(6)用IIS发布