项目-〉填加引用system.runtime.remoting.dll

解决方案 »

  1.   

    还需请教,我以将system.runtime.remoting.dll加入了引用,问题依旧存在
    我将问题的详细清单列出来,请大家帮忙。
    其他信息:远程处理配置失败,异常为 System.IO.FileNotFoundException: 找不到文件或程序集名称“System.Runtime.Remoting”,或找不到它的一个依赖项。
    文件名:“System.Runtime.Remoting”
       at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
       at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)
       at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark)
       at System.Reflection.Assembly.Load(String assemblyString)
       at System.Runtime.Remoting.RemotingConfigInfo.LoadType(String typeName, String assemblyName)
       at System.Runtime.Remoting.RemotingConfigHandler.CreateChannelFromConfigEntry(ChannelEntry entry)
       at System.Runtime.Remoting.RemotingConfigHandler.ConfigureChannels(RemotingXmlConfigFileData configData)
       at System.Runtime.Remoting.RemotingConfigHandler.ConfigureRemoting(RemotingXmlConfigFileData configData)Fusion log follows: 
    === Pre-bind state information ===
    LOG: DisplayName = System.Runtime.Remoting
     (Partial)
    LOG: Appbase = C:\npb\example\Hosted\Hosted\RemoteHost\bin\Debug\
    LOG: Initial PrivatePath = NULL
    Calling assembly : (Unknown).
    ===LOG: Found application configuration file (C:\npb\example\Hosted\Hosted\RemoteHost\bin\Debug\RemoteHost.exe.config).
    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
    LOG: Post-policy reference: System.Runtime.Remoting
    LOG: Attempting download of new URL file:///C:/npb/example/Hosted/Hosted/RemoteHost/bin/Debug/System.Runtime.Remoting.DLL.
    LOG: Attempting download of new URL file:///C:/npb/example/Hosted/Hosted/RemoteHost/bin/Debug/System.Runtime.Remoting/System.Runtime.Remoting.DLL.
    LOG: Attempting download of new URL file:///C:/npb/example/Hosted/Hosted/RemoteHost/bin/Debug/System.Runtime.Remoting.EXE.
    LOG: Attempting download of new URL file:///C:/npb/example/Hosted/Hosted/RemoteHost/bin/Debug/System.Runtime.Remoting/System.Runtime.Remoting.EXE.。
      

  2.   

    我看了下日志,系统试图“download of new URL”其中就包含我的程序路径,如果这样的话,我将动态库拷过来肯定可以,但为什么 declude(Visual C#) 说的方法不行呢?我也觉得就应该是增加项目的引用就可以了。可是还是不行,还有哪里出错了呢?
      

  3.   

    是吗?好吧我把代码粘出来
    主机服务器代码:
    using System;namespace Host
    {
    /// <summary>
    /// Class1 的摘要说明。
    /// </summary>
    public class HostedServer:MarshalByRefObject
    {
    public string GetServerResponse()
    {
    return "Come on baby";
    }
    }
    }
      

  4.   

    主机服务器配置文件:
    <configuration>
      <system.runtime.remoting>
       <application>
         <service>
           <wellknown mode="SingleCall" type="Host.HostedServer,HostedServer" objectUri = "HostedServer.soap" />
         </service>
       </application>    
      </system.runtime.remoting> 
    </configuration>
      

  5.   

    主机实用程序:
    using System;
    using System.Runtime.Remoting;public class RemoteHost
    {
    public static void Main()
    {
    RemotingConfiguration.Configure("RemoteHost.exe.config");
    Console.WriteLine("press key to exit");
    Console.ReadLine(); }
    }
    主机实用程序配置文件:RemoteHost.exe.config
    <configuration>
      <system.runtime.remoting>
       <application name ="HostedServer">
         <service>
           <wellknown mode="SingleCall" type="Host.HostedServer,HostedServer" objectUri="HostedServer.soap" />
         </service>
         <channels>
           <channel port="8000" type="System.Runtime.Remoting.Channels.Http.HttpChannel,System.Runtime.Remoting" />
         </channels>
       </application>    
      </system.runtime.remoting> 
    </configuration>  以上代码编译没有问题,运行时报错。
      

  6.   

    可是我已经在项目管理其中填加引用system.runtime.remoting.dll
      

  7.   

    现在又有运行了一下.net提供的关于remote 的例子,出的问题好像还是这个问题。这会不会时windows环境的配置问题呢?