当垮域访问.net Remoting应用程序时,会出现"The server has rejected the client credentials" 错误. 解决方案就是在客户端模拟授权身份登陆.

客户端代码写法

RemotingConfiguration.Configure(@"C:\remotingdemo\Client\Client.exe.config", true);
RemoteObject obj = new RemoteObject();
... ...

配置文件格式:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <system.runtime.remoting>
  <application>
   <client>
    <wellknown type="RemotingDemo.RemoteObject, General"
         url="tcp://binsu-***:8001/GetObject" />
   </client>
   <channels>
    <channel ref="tcp" secure="true"
      impersonationLevel="Impersonation" protectionLevel="EncryptAndSign"        
      username="administrator" password="******" domain="binsu-***">
     <clientProviders>
      <formatter ref="binary"/>
     </clientProviders>
     <serverProviders>
      <formatter ref="soap" typeFilterLevel="Full" />
      <formatter ref="binary" typeFilterLevel="Full" />
     </serverProviders>
    </channel>
   </channels>
  </application>
 </system.runtime.remoting>
</configuration>

毕!