2011-05-15 87 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