我用的是CSLA.NET,它在wsHttpBinding上运行得很好。现在,我有了自己的Windows-Service并搜索解决方案,我可以将此Windows-Service用作CSLA-Server并使用nettcpbinding。有没有人能给我点建议怎么做?也许有人有我如何做到这一点的样本。
谢谢!
致以最好的问候,托马斯
发布于 2010-04-17 02:40:23
基本上,你需要做两件事:
时选择该端点
在您的服务器端配置中应该有如下内容:
<services>
<service name="YourService">
<endpoint name="something"
address=""
binding="wsHttpBinding"
contract="IYourService" />
</service>
</services>只需为netTcpBinding添加一个端点:
<services>
<service name="YourService">
<endpoint name="something"
address=""
binding="wsHttpBinding"
contract="IYourService" />
<endpoint name="something"
address="net.tcp://YourServer:7171/YourService"
binding="netTcpBinding"
contract="IYourService" />
</service>
</services>现在,如果您在IIS中托管,您可能会遇到一些问题-您需要配置IIS7 (Win2008或Win2008R2服务器),而在IIS6中,您将无法在IIS6中托管您的netTcp服务:-(
在客户端也是如此-为netTcp添加第二个端点:
<client>
<endpoint name="something"
address="http://YourServer/SomeVirtDir/YourServiceFile.svc"
binding="wsHttpBinding"
contract="IYourService" />
<endpoint name="netTcpEndpoint"
address="net.tcp://YourServer:7171/YourService"
binding="netTcpBinding"
contract="IYourService" />
</client>现在,当您在代码中创建端点时,请使用命名端点:
YourServiceClient client = new YourServiceClient("netTcpEndpoint");这应该就是全部了,真的(除非CSLA需要一些我不知道的额外东西……我知道“普通”的WCF)
https://stackoverflow.com/questions/2655066
复制相似问题