Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of WCF programming Application

Shulou Source: shulou.com Published: 2022-06-02 06:41:42 09月30日 Update

This article mainly explains the "WCF programming application example analysis", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "WCF programming application example analysis" bar!

Run the WCF programming application in the background. When prompted, click the OK button to activate debugging in Web.config. Enter a number in the console application window and press enter to show a simple WCF service and client program as shown in the following figure.

Try it: a simple WCF service and client

Perform service operations on WCF asynchronous invocations

A brief introduction to the WCF Framework Service Model

Expound the relevant experience of WCF learning

Detailed analysis of the use of WCF controls

Correct handling of WCF files and solutions

(1) WCF programming: create a new WCF service application project Ch45Ex01 under the directory C:BegVCSharp\ Chapter35

(2) WCF programming: add a console application Ch45Ex01Client to the solution.

(3) WCF programming: click the Build Solution option on the Build menu.

(4) WCF programming: right-click Ch45Ex01Client in Solution Explorer and select the Add Service Reference option.

(5) WCF programming; in the Add Service Reference dialog box, click Discover.

(6) WCF programming: start developing the Web server. After loading the information of the WCF service, expand the reference and view its details, as shown in the figure

(7) WCF programming: click the OK button to add a service reference.

(8) WCF programming: modify the code in Pragram.cs in the Ch45Ex01Client application, as follows:

Using System

Using System.Collections.Generic

Using System.Linq

Using System.Text

Using Ch45Ex01Client.ServiceReference1

Namespace Ch45Ex01Client

{

Class Program

{

Static void Main (string [] args)

{

String numericInput = null

Int intParam

Do

{

Console.WriteLine (

"Enter an integer and press enter to call the WCF service."

NumericInput = Console.ReadLine ()

}

While (! int.TryParse (numericInput, out intParam))

Service1Client client = new Service1Client ()

Console.WriteLine (client.GetData (intParam))

Console.WriteLine ("Press an key to exit.")

Console.ReadKey ()

}

}

}

Thank you for your reading, the above is the content of "WCF programming application example analysis", after the study of this article, I believe you have a deeper understanding of the WCF programming application example analysis of this problem, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Programming program application application service analysis learning content customer button console solution problem control center right code function background enter key Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Linux NVidia Xiaomi macOS