前两天发了提了两个关于Reomting 在WEB项目里使用配置文件的问题,经过两天努力,终于把这个问题给解决了.现在我们来说说.
首先,还是建立一个配置文件app.config.代码如下:
RemotingConfiguration.Configure( @"C:\Inetpub\wwwroot\TestRepotigng\app.config" );
就OK了.
完整代码请参考我前面的文章
首先,还是建立一个配置文件app.config.代码如下:
<configuration>
<system.runtime.remoting>
<application>
<client>
<!--<wellknown type="HelloServer, General" url="http://localhost:8090/SayHello" />-->
<wellknown
mode="Singleton"
type="ClassLibrary3.HelloServer,ClassLibrary3" url="http://192.168.1.101/remoting/HelloServer.soap" />
</client>
<channels>
<channel ref="http" useDefaultCredentials="true" />
</channels>
</application>
</system.runtime.remoting>
</configuration>
之后在Global.asax的Application_Start里加入如下代码:<system.runtime.remoting>
<application>
<client>
<!--<wellknown type="HelloServer, General" url="http://localhost:8090/SayHello" />-->
<wellknown
mode="Singleton"
type="ClassLibrary3.HelloServer,ClassLibrary3" url="http://192.168.1.101/remoting/HelloServer.soap" />
</client>
<channels>
<channel ref="http" useDefaultCredentials="true" />
</channels>
</application>
</system.runtime.remoting>
</configuration>
RemotingConfiguration.Configure( @"C:\Inetpub\wwwroot\TestRepotigng\app.config" );
就OK了.
完整代码请参考我前面的文章