使用WCF工具解决WCF服务时出错

时间:2011-11-20 21:22:51

标签: c# wcf castle-windsor wcffacility

我一直收到以下错误:

Method not found: 'Void Castle.MicroKernel.ComponentActivator.ComponentActivatorException..ctor

这来自global.asax中的以下初始化代码:

    private void ConfigureContainer()
    {
        _container = new WindsorContainer();

        _container.Register(Component.For<IWindsorContainer>().Instance(_container))
            .AddFacility<WcfFacility>()
            .Register(Component.For<ISonatribeCommandService>()
                          .AsWcfClient(DefaultClientModel
                          .On(WcfEndpoint.FromConfiguration("commandServiceClient")))
                          .LifestyleTransient())
            .Install(FromAssembly.InDirectory(new AssemblyFilter(HttpRuntime.BinDirectory, "Sonatribe*.dll")));

    }

web.config中的system.servicemodel部分如下所示:

  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <client>
      <endpoint address="http://****.com/SonatribeCommandService.svc" binding="basicHttpBinding" contract="CommandService.ISonatribeCommandService" name="commandServiceClient"></endpoint>
    </client>
  </system.serviceModel>

使用添加Web引用方法时,该服务正常工作。

更新:

我也尝试过配置方法:

<configuration>
  <components>
    <component 
      id="commandService" 
      type="CommandService.SonatribeCommandService, CommandService"
      wcfEndpointConfiguration="commandServiceClient" />
  </components>
</configuration>

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

看起来你正在使用不兼容的Windsor版本和设施。确保您使用的WCF工具版本与您拥有的Windsor版本一起使用。