我是否需要 svc 文件来为非 HTTP 服务设置 Castle Wcf 设施
我对城堡 wcf 设施注册感到困惑。
我阅读了一些有关 BasicHttpBinding 的博客文章。 但无法找到一个清晰简单的示例来设置 net.tcp 设置。
我想从控制台应用程序托管服务...
我写了这样的东西...你能看到这里有问题吗?
_container = new WindsorContainer();
_container.AddFacility<WcfFacility>();
_container.Register(Component.For<IMembershipService>().ImplementedBy<MembershipService>()
.AsWcfService(
new DefaultServiceModel()
.AddEndpoints(WcfEndpoint
.BoundTo(new NetTcpBinding() { PortSharingEnabled = false })
.At("net.tcp://localhost/MembershipService")
)
.PublishMetadata()
)
);
I am confused about the castle wcf facility registration.
I read some blog posts for BasicHttpBinding.
But could not find a clear easy sample to setup a net.tcp setup.
I want to host the service from a console application...
I wrote something like this... can you see a problem here?
_container = new WindsorContainer();
_container.AddFacility<WcfFacility>();
_container.Register(Component.For<IMembershipService>().ImplementedBy<MembershipService>()
.AsWcfService(
new DefaultServiceModel()
.AddEndpoints(WcfEndpoint
.BoundTo(new NetTcpBinding() { PortSharingEnabled = false })
.At("net.tcp://localhost/MembershipService")
)
.PublishMetadata()
)
);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您希望发布元数据,则需要启用端口共享(让 MEX 端点与常规 TCP 端口共享相同的端口 - 如果将此设置为 false,您将收到 AddressAlreadyInUse 异常),并且您可能需要指定URL 上的端口(不确定 TCP 会使用哪个端口),所以您的代码应该是(假设端口 8080 适合您):
使用 castle Windsor 3.0 可以正常工作。
If you wish to publish metadata you will need to enable port sharing (to let the MEX endpoint share the same port as the regular TCP port - you'll get an AddressAlreadyInUse exception if you have this set to false) and you probably need to specify a port on your URL (not sure what port TCP would use otherwise), so your code should be (assuming port 8080 is OK for you):
This works fine using castle windsor 3.0.