. Net Technical FAQ (10)-Miscellaneous

Source: Internet
Author: User

10. Miscellaneous
10.1 how does. NET remote computing work?
. Net Remote Computing involves sending messages through channels. The two standard channels are HTTP and TCP. Only on the LAN tends to use TCP-HTTP can be used on the LAN and WAN (Internet.
Now supports multiple serialized message formats, such as soap (based on XML) and binary format. By default, the HTTP channel uses soap (serialization soap formatter Of the. NET Runtime Library), and the TCP channel uses binary format (serialization binary formatter Of the. NET Runtime Library ). However, each channel can use any serialized format.
Here are some remote access methods:
Singlecall. Each request from the client is served by a new object. The object is discarded after the request is complete. The ASP + country service can be used in the ASP + environment to save the country of the application or session, so that this model (without country division) becomes nationally supported.
 
Singleton. All requests on the client are processed by a single server object.
 
Client-activated object. This is the old (d) com model supported by the country. Here, the client is referenced by a remote object and retains this reference (to keep the remote object alive ), until the access to it is complete.
The distributed garbage collection of objects is managed by a "lease-based life cycle. Each object has a lease time. When this time is reached, the object is disconnected from the remote sub-structure of the. NET Runtime Library. The default Update Time of the object-the lease time is updated when a successful call initiated from the client is made. The client can also display and update the lease time.
 
 
10.2 how to obtain the Win32 API in the. NET program?
Use P/invoke. It uses similar technologies as com interoperability, but is used to access static DLL endpoints rather than COM objects. The following is a C # program example that calls the Win32 MessageBox function:
Using system;
Using system. runtime. interopservices;

Class mainapp
{
[Dllimport ("user32.dll", entrypoint = "MessageBox", setlasterror = true, charset = charset. Auto)]
Public static extern int MessageBox (INT hwnd, string strmessage, string strcaption, uint uitype );

Public static void main ()
{
MessageBox (0, "Hello, this is pinvoke in operation! ",". Net ", 0 );
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.