2010-04-16 63 views
1

我正在使用CSLA.NET。它对wsHttpBinding非常好用。现在,我有自己的Windows服务并搜索解决方案,我可以使用此Windows服务作为CSLA服务器并使用nettcpbinding。有人可以给我一个小费如何继续?也许有人有一个样本,我可以做到这一点。使用WCF的CSLA nettcpbinding

谢谢!

最好的问候,托马斯

回答

1

基本上,你需要做两件事情:

  • 改变你的服务器端配置包括与NetTcpBinding的端点(这可能是除了现有的WsHttpBinding的终点 - 没问题)

  • 添加NetTcpBinding的客户到客户的配置文件,以及和选择端点当您连接

你应该有这样的事情在你的服务器端配置:

<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服务:-(

t当你在代码中创建您的端点,使用命名的端点

<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要求 - 他的客户端添加第二个端点netTcp一些额外的,我不知道....我知道“普通香草”WCF)