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

发布于 2024-12-17 06:35:42 字数 1629 浏览 4 评论 0原文

我不断收到以下错误:

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>

有什么想法吗?

I keep getting the following error:

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

this is from the following initialization code in 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")));

    }

my system.servicemodel section in web.config looks like:

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

The service works fine when using the add web reference method.

UPDATE:

I also tried doing the config method too:

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

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋日私语 2024-12-24 06:35:43

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

It looks like you're using incompatible versions of Windsor and the facility. Make sure you're using version of WCF Facility that was meant to be used with the version of Windsor you have.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文