本文整理汇总了C#中ServiceClient.Close方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceClient.Close方法的具体用法?C# ServiceClient.Close怎么用?C# ServiceClient.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceClient
的用法示例。
在下文中一共展示了ServiceClient.Close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Index
// GET: Match
public ActionResult Index()
{
ServiceClient webService = new ServiceClient();
ViewBag.Matchs = webService.GetMatchs();
webService.Close();
return View();
}
示例2: Index
// GET: Game
public ActionResult Index()
{
ServiceClient webService = new ServiceClient();
ViewBag.Tournois = webService.GetTournois().Select(t => new SelectListItem { Text = t.Nom, Value = t.ID.ToString()});
webService.Close();
return View();
}
示例3: WorkflowExtensionsBehaviorAddsExtension
public void WorkflowExtensionsBehaviorAddsExtension()
{
WorkflowServiceTestHost host = null;
// TODO: Test with multiple extensions
// TODO: Test with bad config file entries
var serviceEndpoint1 = ServiceTest.GetUniqueEndpointAddress();
using (host = WorkflowServiceTestHost.Open("ServiceExtensionTest.xamlx", serviceEndpoint1))
{
try
{
var proxy = new ServiceClient(ServiceTest.Pipe, serviceEndpoint1);
try
{
proxy.GetData(1);
proxy.Close();
}
catch (Exception)
{
proxy.Abort();
throw;
}
}
finally
{
if (host != null)
{
host.Tracking.Trace();
}
}
}
}
示例4: Register
public string Register(Empleado emp)
{
ServiceClient service = new ServiceClient();
service.CreateUser(emp);
service.Close();
return "Se ha creado el usuario con exito";
}
示例5: Bet
public ActionResult Bet(string Tournois)
{
ServiceClient webService = new ServiceClient();
TournoiContract tournoi= webService.GetTournoi(int.Parse(Tournois));
var jedis= tournoi.Matchs.Select(m => m.Jedi1).Union(tournoi.Matchs.Select(m => m.Jedi2));
ViewBag.Tournoi = tournoi;
ViewBag.Jedis = jedis.Select(t => new SelectListItem { Text = t.Nom, Value = t.ID.ToString() });
webService.Close();
return View();
}
示例6: Result
public ActionResult Result(string Tournoi, string Jedis)
{
ServiceClient webService = new ServiceClient();
Random rdm = new Random();
ViewBag.Tournoi = webService.GetTournoi(int.Parse(Tournoi));
ViewBag.Jedi = webService.GetJedi(int.Parse(Jedis));
ViewBag.HasWin = (rdm.Next(2)==1);
webService.Close();
return View();
}
示例7: ParseSimilarity
public static double ParseSimilarity(string File1, string File2)
{
// Create client
ServiceClient WZNTServices = new ServiceClient();
double Similarity = WZNTServices.ParseSimilarity(File1, File2);
Log.Info(string.Format("Images have {0} of similarity", Similarity));
// Close the client.
WZNTServices.Close();
return Similarity;
}
示例8: Test1
static void Test1()
{
var client = new ServiceClient();
for (int i = 0; i < 3; i++) {
var i1 = i;
Task.Factory.StartNew(() => {
Console.WriteLine(string.Format("-------------开始-------------{0}-{1}----------------------------", i1, DateTime.Now));
//using () {
double value1 = 100.00D;
double value2 = 15.99D;
double result = client.Add(value1, value2);
Console.WriteLine(string.Format("--------------结束------------{0}-{1}-----{2}-----------------------", i1, DateTime.Now, result));
//client.Close();
//}
});
}
Thread.Sleep(9000);
using (var client1 = new Online.ClientTest.ServiceReference2.Service1Client()) {
double value1 = 100.00D;
double value2 = 15.99D;
Console.WriteLine(string.Format("-------------开始01-------------{0}-{1}----------------------------", "1111", DateTime.Now));
double result = client1.Subtract(value1, value2);
Console.WriteLine(string.Format("--------------结束01------------{0}-{1}-----{2}-----------------------", result, DateTime.Now, result));
client.Close();
}
//for (int i = 0; i < 100; i++) {
// var i1 = i;
// Task.Factory.StartNew(() => {
// Console.WriteLine(string.Format("-------------开始-------------{0}-{1}----------------------------", i1, DateTime.Now));
// using (var client = new OauthClient()) {
// double value1 = 100.00D;
// double value2 = 15.99D;
// var result = client.Code("2345");
// Console.WriteLine(string.Format("--------------结束------------{0}-{1}-----{2}-----------------------", i1, DateTime.Now, result));
// }
// });
//}
Console.WriteLine("Press <ENTER> to terminate client.");
Console.ReadLine();
//using (var client = new ServiceClient()) {
// double value1 = 100.00D;
// double value2 = 15.99D;
// double result = client.Add(value1, value2);
// Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);
// Console.WriteLine("Press <ENTER> to terminate client.");
// Console.ReadLine();
//}
}
示例9: Main
static void Main()
{
ServiceClient client = new ServiceClient();
client.Start();
Console.WriteLine("Activating Durable Delay Service");
Console.WriteLine("Done - see C:\\WFDurableDelaySampleResult.txt");
Console.WriteLine("Press <ENTER> to exit.");
Console.ReadLine();
client.Close();
}
示例10: Departments
public RedirectToRouteResult Departments(DepartamentoMirror departamentoMirror)
{
if(departamentoMirror.Descripcion == null)
return RedirectToAction("Departments");
ServiceClient service = new ServiceClient();
departamentoMirror.Activo = true;
service.CreateDepartment(departamentoMirror);
service.Close();
return RedirectToAction("Departments");
}
示例11: Index
public RedirectToRouteResult Index(LoginModel log)
{
ServiceClient service = new ServiceClient();
Empleado emp = service.LogIn(log.Email, log.Password);
if (emp != null)
{
Session["User"] = emp;
return RedirectToAction("Dashboard", "AccountPage");
}
Session["User"] = null;
service.Close();
return RedirectToAction("Index");
}
示例12: ButtonSubmit_Click
protected void ButtonSubmit_Click(object sender, EventArgs e)
{
var proxy = new ServiceClient();
try
{
var sampleResponse = proxy.GetData(TextBoxKey.Text);
LabelValue.Text = sampleResponse.Data.Value;
RadioButtonHit.Checked = sampleResponse.CacheHit;
RadioButtonMiss.Checked = !sampleResponse.CacheHit;
proxy.Close();
}
catch (Exception)
{
proxy.Abort();
throw;
}
}
示例13: asyncsyncOperation
public static void asyncsyncOperation()
{
ServiceClient client = new ServiceClient("WSHttpBinding_IService");
Data s1 = new Data() { name = "saeid1" };
Data s2 = new Data() { name = "saeid2" };
client.addData(s1);
client.addData(s2);
//client.getListCompleted += new EventHandler<getListCompletedEventArgs>(client_getListCompleted);
//client.getListAsync();
Console.WriteLine("waiting");
//waits till finishes
client.Close();
//aborts no matter not completed
//client.Abort();
}
示例14: Diagnose
static void Diagnose(int selection)
{
ServiceClient client = new ServiceClient();
string rtn = "";
if (selection == 1)
rtn = client.DiagnoseStart();
else if (selection == 2)
rtn = client.DiagnoseAC();
Console.WriteLine(rtn);
bool input;
while (!rtn.ToLower().Contains("diagnosis complete"))
{
input = GetInput();
rtn = client.NextStep(input);
Console.WriteLine(rtn);
}
client.Close();
client.ChannelFactory.Close();
}
示例15: Main
static void Main(string[] args)
{
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
InstanceContext site = new InstanceContext(null, new Program());
_client = new ServiceClient(site);
//Subscribe.
Console.WriteLine("Subscribing");
_client.Subscribe();
Console.WriteLine();
Console.WriteLine("Press ENTER to unsubscribe and shut down client");
Console.ReadLine();
Console.WriteLine("Unsubscribing");
_client.Unsubscribe();
//Closing the client gracefully closes the connection and cleans up resources
_client.Close();
}