WCF服務和客戶端可以共享關於綁定等的相同設置(來自同一個配置文件)。無論在哪裏?換句話說,我可以編寫單個綁定部分並放入任何內容,並確保它對服務和客戶端有好處嗎?在服務和客戶端之間共享WCF設置
我會解釋得更好。 我有一個配置文件是這樣的:
<services>
<service name="TestClass1">
<endpoint binding="basicHttpBinding" address="http://dev00:4322/host1/TestApplication1" contract="myApp.Interface.ITestApplication"/>
<endpoint binding="netTcpBinding" bindingConfiguration="Binding1" address="net.tcp://dev00:4321/host1/TestApplication1" contract="myApp.Interface.ITestApplication"/>
<endpoint binding="netNamedPipeBinding" address="net.pipe://localhost/host1/TestApplication1" contract="myApp.Interface.ITestApplication"/>
</service>
<service name="ManagementClass1">
<endpoint binding="netNamedPipeBinding" address="net.pipe://localhost/host1/ManagementApplication1" contract="myApp.Interface.IManagementApplication"/>
<endpoint binding="netTcpBinding" bindingConfiguration="Binding1" address="net.tcp://dev00:4321/host1/ManagementApplication1" contract="myApp.Interface.IManagementApplication"/>
</service>
</services>
<client>
<endpoint name="clientTestClass1Tcp"
address="net.tcp://dev00:4321/host1/TestApplication1"
binding="netTcpBinding"
bindingConfiguration="Binding1"
contract="myApp.Interface.ITestApplication"/>
<endpoint name="clientManagementClass1Tcp"
address="net.tcp://dev00:4321/host1/ManagementApplication1"
binding="netTcpBinding"
bindingConfiguration="Binding1"
contract="myApp.Interface.IManagementApplication"/>
</client>
<bindings>
<netTcpBinding>
<binding name="Binding1"
closeTimeout="00:00:10"
openTimeout="00:00:10"
receiveTimeout="00:01:00"
sendTimeout="00:01:00"
transactionFlow="false"
transferMode="Buffered"
transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard"
listenBacklog="10"
maxBufferPoolSize="524288"
maxBufferSize="65536"
maxConnections="30"
maxReceivedMessageSize="65536">
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</netTcpBinding>
</bindings>
不是所有是我的控制之下。 我可以肯定,共享服務和客戶端之間的綁定(和其他部分),無論寫入什麼,在服務和客戶端都一切順利嗎?