Castle remoting sample - client throwing exception

邮差的信 提交于 2019-12-12 01:16:38

问题


I am using the sample from castle @ http://old.castleproject.org/container/facilities/trunk/remoting/containersconnected.html for "Scenario: Using the container on both endpoints and use the container components"

The only update I have made to this is one line in the config files from type="Castle.Facilities.Remoting.RemotingFacility, Castle.MicroKernel" to type="Castle.Facilities.Remoting.RemotingFacility, Castle.Windsor" as suggested by Mauricio in question Castle remoting facility not working

I also updated the references in both the client and server to use latest castle dlls. The server starts up successfully but the client does not. I get the following exception on the client:

Could not set up component 'remote.console.component'. Type 'System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' does not implement service 'Example.Shared.IRemoteConsole, Example.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Any suggests on what I am doing wrong?

The following is the client config file

<?xml version="1.0"?>
<configuration>
    <configSections>
        <section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor"/>
    </configSections>

    <castle>
        <facilities>
            <facility id="remote.facility"
                type="Castle.Facilities.Remoting.RemotingFacility, Castle.Windsor"
                baseUri="tcp://localhost:2133"
                isClient="true"
                remoteKernelUri="tcp://localhost:2133/kernel.rem"
                remotingConfigurationFile="RemotingTcpConfigClient.config">
            </facility>
        </facilities>

        <components>
            <component
                id="remote.console.component"
                service="Example.Shared.IRemoteConsole, Example.Shared"
                type="System.Object, mscorlib"
                remoteclient="component"/>
        </components>
    </castle>

</configuration>

回答1:


Replace:

<component
       id="remote.console.component"
       service="Example.Shared.IRemoteConsole, Example.Shared"
       type="System.Object, mscorlib"
       remoteclient="component"/>

with:

<component
       id="remote.console.component"
       type="Example.Shared.IRemoteConsole, Example.Shared"
       remoteclient="component"/>


来源:https://stackoverflow.com/questions/4557796/castle-remoting-sample-client-throwing-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!