2011-05-15 85 views
1

我正在尝试将我的WCF服务配置为使用net.tcp或netnamedpipes。使用net.tcp的WCF设施

这里是我的容器配置(我注释掉现有的HTTP绑定):

 var metadata = new ServiceMetadataBehavior 
     { 
      HttpGetEnabled = true 
     }; 

     var debug = new ServiceDebugBehavior 
     { 
      IncludeExceptionDetailInFaults = true 
     }; 

     container.AddFacility<WcfFacility>(f => f.Services.AspNetCompatibility = 
              AspNetCompatibilityRequirementsMode.Required) 
      .Install(Configuration.FromAppConfig()) 
      .Register(
       Component.For<IServiceBehavior>().Instance(metadata), 
       Component.For<IServiceBehavior>().Instance(debug), 
       Component 
        .For<IAccountService>() 
        .ImplementedBy<AccountService>() 
        .Named("SomeCompany.Services.Account.AccountService") 
        .LifeStyle.Transient 
        .ActAs(new DefaultServiceModel().Hosted().AddEndpoints(
            //WcfEndpoint.BoundTo(new BasicHttpBinding { MaxReceivedMessageSize = int.MaxValue }), 
            //WcfEndpoint.BoundTo(new WSHttpBinding(SecurityMode.None) { MaxReceivedMessageSize = int.MaxValue }).At("ws"), 
            WcfEndpoint.BoundTo(new NetTcpBinding()).At("net.tcp://localhost/Account") 
           )), 
       Component 
        .For<IAccountNetworkService>() 
        .ImplementedBy<AccountNetworkService>() 
        .Named("SomeCompany.Services.Account.AccountNetworkService") 
        .LifeStyle.Transient 
        .ActAs(new DefaultServiceModel().Hosted() 
           .AddEndpoints(
            WcfEndpoint.BoundTo(new BasicHttpBinding { MaxReceivedMessageSize = int.MaxValue }), 
            WcfEndpoint.BoundTo(new WSHttpBinding(SecurityMode.None) { MaxReceivedMessageSize = int.MaxValue }).At("ws") 
           )) 
      ); 

我的客户有以下几点:

<endpoint address="net.tcp://localhost/Account" binding="netTcpBinding" contract="SomeCompany.Services.Account.Contracts.IAccountService" name="accountServiceClient"></endpoint> 

当我尝试访问我得到的服务以下内容:

No connection could be made because the target machine actively refused it 127.0.0.1:808 

我也尝试了放在这个wiki底部的建议:

http://docs.castleproject.org/(S(hv034j45ln0cgt2zkpl1nce5))/Windsor.WCF-Facility-Registration.ashx

我在这里缺少的东西明目张胆?

+0

我相信大部分人不熟悉使用城堡温莎配置的WCF服务,所以你可能有更多的运气得到答案,如果你翻译成“传统”网络/的app.config – Schneider 2011-05-15 13:52:52

+0

的问题是这样的与城堡wcf设施:) – iwayneo 2011-05-15 15:06:36

+0

迟到的游戏,但你需要指定的端口号? WcfEndpoint.BoundTo(new NetTcpBinding())。(“net.tcp:// localhost:808/Account”) – 2011-08-31 08:46:34

回答

0

嗨,看起来像一个防火墙问题当我的Windows防火墙提示我为我的应用程序的权限时,类似的事情发生在我身上,我单击取消而不是确定。请尝试禁用Windows防火墙并检查错误是否仍然发生。

另一个可能的问题是您用于绑定的那种安全性。尝试在服务器和客户端的绑定配置中添加以下节点。

+0

它在本地机器上 - 我仍然尝试,但仍然没有喜悦:( – iwayneo 2011-05-16 06:03:18