我猜这可以通过实现IServiceBehavior来实现。
例如....
<behaviors>
<serviceBehaviors>
<behavior name="MyBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug />
<customBehavior myCompany="ABC" />
</behavior>
<behavior name="MyOtherBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug />
<customBehavior myCompany="DEF" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MyBehavior" name="MyNameSpace.MyService">
<endpoint address="" behaviorConfiguration="" binding="netTcpBinding"
name="TcpEndpoint" contract="MyNameSpace.IMyService" />
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
name="TcpMexEndpoint" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:4000/MyService" />
</baseAddresses>
</host>
</service>
<service behaviorConfiguration="MyOtherBehavior" name="MyNameSpace.MyOtherService">
<endpoint address="" behaviorConfiguration="" binding="netTcpBinding"
name="TcpEndpoint" contract="MyNameSpace.IMyOtherService" />
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
name="TcpMexEndpoint" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:4000/MyOtherService" />
</baseAddresses>
</host>
</service>
</services>
假设它们具有某个公司名称的共同接口,将ABC设置在MyService上,DEF设置在MyOtherService上。
有人可以详细说明如何实现吗?
TIA
迈克尔