markus / FinalService / FinalServiceBase / Markus.Service.WcfService / Helper / WcfClientHelper.cs @ 42d49521
이력 | 보기 | 이력해설 | 다운로드 (922 Bytes)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Text; |
5 |
using System.Threading.Tasks; |
6 |
using System.ServiceModel; |
7 |
using System.ServiceModel.Description; |
8 |
using System.Web.Services; |
9 |
using System.ServiceModel.Channels; |
10 |
using System.Xml; |
11 |
|
12 |
namespace Markus.Service.IWcfService |
13 |
{ |
14 |
public static class WcfClientHelper |
15 |
{ |
16 |
public static T BasicHttpBindingClient<T>(Uri ServiceEndpointAddress) |
17 |
{ |
18 |
BasicHttpBinding myBinding = new BasicHttpBinding(); |
19 |
|
20 |
EndpointAddress myEndpoint = new EndpointAddress(ServiceEndpointAddress); |
21 |
|
22 |
ChannelFactory<T> myChannelFactory = new ChannelFactory<T>(myBinding, myEndpoint); |
23 |
|
24 |
T wcfClient = myChannelFactory.CreateChannel(); |
25 |
|
26 |
return wcfClient; |
27 |
} |
28 |
|
29 |
public static void ClientClose(IClientChannel client) |
30 |
{ |
31 |
client.Close(); |
32 |
} |
33 |
} |
34 |
} |