Straight to the point, before learning a stupid want to ask everyone, about WebService remote Procedure call Technology (RPC) Are you sure you're going to do it? WebService technology is obsolete, If your heart is secretly telling you that I really do not webservice, then congratulations, because you in the boundless it programming world to find this "C # Remote Call technology WebService Sunflower Treasure Book"! There was once an unknown lecturer who said such a famous saying: One RPC technology will not, then entry door RPC technology won't!
This session contains the following points of knowledge.
1, C # WebService commonly used several methods of invocation.
2. WebService how to use asynchronous calls. (based on asynchronous delegate Begininvoke/endinvoke, delegate-based event mechanism, async task Async Programming Mode)
3, C # WebService How to ensure that the client access in a secure manner.
4. C # Dynamically creates WebService instances through reflection (Reflection).
5. The basic use of Microsoft's lightweight IOC framework unity.
Here's a hard ad: The next sharing course, the stupid plan will bring you the "C # Service-oriented programming technology for WCF from beginner to practical walkthrough."
If you are interested in this sharing lesson, then please follow up with AH-stupid study it. Needless to say, directly on dry goods, we do not produce dry goods, we are just dry goods porter.
Second, C # WebService two different ways to use the reference
2.1, Web references Way reference.
2.2, Service references way reference.
Iii. C # WebService How to use asynchronous calls
3.1, based on the asynchronous delegate Begininvoke/endinvoke.
3.2. Event mechanism based on delegate events.
3.3. Async Task-based asynchronous programming model.
Iv. C # WebService How to ensure that clients are accessed in a secure manner
4.1, first talk about what is safe? What problems do we need to solve?
Call security: Since WebService is exposed to public networks, how can we prevent illegal users from invoking our services? So we need to solve: licensing issues.
Data transfer security: Because our data is transmitted through ciphertext on the network can easily be stolen. So we need to solve this problem: data theft.
The above explanation is only a narrow understanding of the stupid, network security also includes many aspects, session hijacking, session tampering and so on.
4.2, a stupid share of the current several common solutions.
1, WebService each method needs to pass a token fixed parameter, different caller's respective token value is not the same. The server has a set of rule algorithms that generate token values, persisting this value in a relational database or in a file and in an in-memory database.
2. WebService uses the authentication mechanism of ASP. Common authentication methods are: Form authentication, Integrated Windows authentication, basic basic certification, Digest Digest authentication,
3, WebService using SSL to achieve encrypted transmission.
HTTPS (full name: Hyper Text Transfer Protocol over secure Socket Layer) secure transport protocol. (Highly recommended)
4, through the webservice to provide us with the SoapHeader to achieve user authentication. (Highly recommended)
A fool will give you a practical link to share an elegant way to authenticate against WebService.
5, the above several solutions to combine the use. (Personal recommended Use: ③+④ two solutions for combined use) (Highly recommended)
Summary: We can use SoapHeader to ensure the authorization of webservice, can guarantee the encryption of data through SSL, prevent the network to listen!
V. C # WebService how to use SoapHeader for authentication
WebService authentication
Vi. C # WebService How to make unified portal calls in an elegant way
6.1, Unity Container way to get WebService service instance.
6.2, reflect reflection way to get WebService service instances (recommended). (Edit: Lelinpeng Source: Network)
C # Remote Call technology WebService Sunflower Treasure Book