我正在嘗試將我的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
我在這裏缺少的東西明目張膽?
我相信大部分人不熟悉使用城堡溫莎配置的WCF服務,所以你可能有更多的運氣得到答案,如果你翻譯成「傳統」網絡/的app.config – Schneider 2011-05-15 13:52:52
的問題是這樣的與城堡wcf設施:) – iwayneo 2011-05-15 15:06:36
遲到的遊戲,但你需要指定的端口號? WcfEndpoint.BoundTo(new NetTcpBinding())。(「net.tcp:// localhost:808/Account」) – 2011-08-31 08:46:34