@@ -11,7 +11,7 @@ namespace CoreWcf.Samples.WindowsService
1111{
1212
1313
14- [ System . CodeDom . Compiler . GeneratedCodeAttribute ( "Microsoft.Tools.ServiceModel.Svcutil" , "2.0.3 " ) ]
14+ [ System . CodeDom . Compiler . GeneratedCodeAttribute ( "Microsoft.Tools.ServiceModel.Svcutil" , "2.1.0 " ) ]
1515 [ System . ServiceModel . ServiceContractAttribute ( ConfigurationName = "CoreWcf.Samples.WindowsService.ICalculatorService" ) ]
1616 public interface ICalculatorService
1717 {
@@ -41,13 +41,13 @@ public interface ICalculatorService
4141 System . Threading . Tasks . Task < double > DivideAsync ( double n1 , double n2 ) ;
4242 }
4343
44- [ System . CodeDom . Compiler . GeneratedCodeAttribute ( "Microsoft.Tools.ServiceModel.Svcutil" , "2.0.3 " ) ]
44+ [ System . CodeDom . Compiler . GeneratedCodeAttribute ( "Microsoft.Tools.ServiceModel.Svcutil" , "2.1.0 " ) ]
4545 public interface ICalculatorServiceChannel : CoreWcf . Samples . WindowsService . ICalculatorService , System . ServiceModel . IClientChannel
4646 {
4747 }
4848
4949 [ System . Diagnostics . DebuggerStepThroughAttribute ( ) ]
50- [ System . CodeDom . Compiler . GeneratedCodeAttribute ( "Microsoft.Tools.ServiceModel.Svcutil" , "2.0.3 " ) ]
50+ [ System . CodeDom . Compiler . GeneratedCodeAttribute ( "Microsoft.Tools.ServiceModel.Svcutil" , "2.1.0 " ) ]
5151 public partial class CalculatorServiceClient : System . ServiceModel . ClientBase < CoreWcf . Samples . WindowsService . ICalculatorService > , CoreWcf . Samples . WindowsService . ICalculatorService
5252 {
5353
@@ -58,13 +58,6 @@ public partial class CalculatorServiceClient : System.ServiceModel.ClientBase<Co
5858 /// <param name="clientCredentials">The client credentials</param>
5959 static partial void ConfigureEndpoint ( System . ServiceModel . Description . ServiceEndpoint serviceEndpoint , System . ServiceModel . Description . ClientCredentials clientCredentials ) ;
6060
61- public CalculatorServiceClient ( ) :
62- base ( CalculatorServiceClient . GetDefaultBinding ( ) , CalculatorServiceClient . GetDefaultEndpointAddress ( ) )
63- {
64- this . Endpoint . Name = EndpointConfiguration . BasicHttpBinding_ICalculatorService . ToString ( ) ;
65- ConfigureEndpoint ( this . Endpoint , this . ClientCredentials ) ;
66- }
67-
6861 public CalculatorServiceClient ( EndpointConfiguration endpointConfiguration ) :
6962 base ( CalculatorServiceClient . GetBindingForEndpoint ( endpointConfiguration ) , CalculatorServiceClient . GetEndpointAddress ( endpointConfiguration ) )
7063 {
@@ -136,11 +129,6 @@ public virtual System.Threading.Tasks.Task OpenAsync()
136129 return System . Threading . Tasks . Task . Factory . FromAsync ( ( ( System . ServiceModel . ICommunicationObject ) ( this ) ) . BeginOpen ( null , null ) , new System . Action < System . IAsyncResult > ( ( ( System . ServiceModel . ICommunicationObject ) ( this ) ) . EndOpen ) ) ;
137130 }
138131
139- public virtual System . Threading . Tasks . Task CloseAsync ( )
140- {
141- return System . Threading . Tasks . Task . Factory . FromAsync ( ( ( System . ServiceModel . ICommunicationObject ) ( this ) ) . BeginClose ( null , null ) , new System . Action < System . IAsyncResult > ( ( ( System . ServiceModel . ICommunicationObject ) ( this ) ) . EndClose ) ) ;
142- }
143-
144132 private static System . ServiceModel . Channels . Binding GetBindingForEndpoint ( EndpointConfiguration endpointConfiguration )
145133 {
146134 if ( ( endpointConfiguration == EndpointConfiguration . BasicHttpBinding_ICalculatorService ) )
@@ -152,32 +140,37 @@ private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(Endpoi
152140 result . AllowCookies = true ;
153141 return result ;
154142 }
143+ if ( ( endpointConfiguration == EndpointConfiguration . NetTcpBinding_ICalculatorService ) )
144+ {
145+ System . ServiceModel . NetTcpBinding result = new System . ServiceModel . NetTcpBinding ( ) ;
146+ result . MaxBufferSize = int . MaxValue ;
147+ result . ReaderQuotas = System . Xml . XmlDictionaryReaderQuotas . Max ;
148+ result . MaxReceivedMessageSize = int . MaxValue ;
149+ result . Security . Mode = System . ServiceModel . SecurityMode . None ;
150+ return result ;
151+ }
155152 throw new System . InvalidOperationException ( string . Format ( "Could not find endpoint with name \' {0}\' ." , endpointConfiguration ) ) ;
156153 }
157154
158155 private static System . ServiceModel . EndpointAddress GetEndpointAddress ( EndpointConfiguration endpointConfiguration )
159156 {
160157 if ( ( endpointConfiguration == EndpointConfiguration . BasicHttpBinding_ICalculatorService ) )
161158 {
162- return new System . ServiceModel . EndpointAddress ( "http://localhost:5000/CalculatorService/basicHttp" ) ;
159+ return new System . ServiceModel . EndpointAddress ( "http://localhost:5000/CalculatorService/basicService/CalculatorService/basicHttp" ) ;
160+ }
161+ if ( ( endpointConfiguration == EndpointConfiguration . NetTcpBinding_ICalculatorService ) )
162+ {
163+ return new System . ServiceModel . EndpointAddress ( "net.tcp://localhost:8089/CalculatorService/netTcp" ) ;
163164 }
164165 throw new System . InvalidOperationException ( string . Format ( "Could not find endpoint with name \' {0}\' ." , endpointConfiguration ) ) ;
165166 }
166167
167- private static System . ServiceModel . Channels . Binding GetDefaultBinding ( )
168- {
169- return CalculatorServiceClient . GetBindingForEndpoint ( EndpointConfiguration . BasicHttpBinding_ICalculatorService ) ;
170- }
171-
172- private static System . ServiceModel . EndpointAddress GetDefaultEndpointAddress ( )
173- {
174- return CalculatorServiceClient . GetEndpointAddress ( EndpointConfiguration . BasicHttpBinding_ICalculatorService ) ;
175- }
176-
177168 public enum EndpointConfiguration
178169 {
179170
180171 BasicHttpBinding_ICalculatorService ,
172+
173+ NetTcpBinding_ICalculatorService ,
181174 }
182175 }
183176}
0 commit comments