Windows Communication Foundation (WCF) is a software development kit (SDK) that develops and deploys services based on windows ).
WCF is Microsoft's integrator of distributed processing programming technology. It integrates DCOM, remoting, Web Service, WSE, and MSMQ, reducing the learning curve of distributed system developers, and unified development standards.
WCF is built on. NET Framework 2.0 and included in. Net 3.0/3.5. 2005 does not contain WCF, but after winfx runtime components is installed, we can develop and createProgram.
I. WCF
In summary, WCF has the following advantages:
1. Uniformity
As described above, WCF is an integration of asmx,. Net remoting, Enterprise Service, WSE, MSMQ, and other technologies. Since WCF is fully managedCodeTherefore, develop the WCF application and develop other applications. there is no big difference between. NET applications. We can still use WCF to create service-oriented applications like creating object-oriented applications.
2. Interoperability
Since the most basic communication mechanism of WCF is soap, this ensures the interoperability between systems, even when different contexts are run. This communication can be based on the communication between. NET and. net.
Cross-process, cross-machine, or cross-platform communication is supported as long as standard web services, such as J2EE application servers (such as WebSphere and WebLogic) are supported ). Applications can run in Windows or other operating systems, such as Sun Solaris, hp unix, and Linux.
3. Security and trustworthiness
WS-Security, WS-trust, and WS-secureconversation are added to soap messages for user authentication, data integrity verification, data privacy, and other security factors.
WS-reliablemessaging is added to the SOAP header to allow trusted end-to-end communication. The soap-based information exchange based on WS-coordination and WS-atomictransaction supports two-phase commit transactions ).
The preceding WS-policies are supported in WCF. For messaging, soap is the basic protocol of Web Service. It contains the header and body ). In the message header, WS-Addressing is defined to locate the address information of the SOAP message, and MTOM (message transmission optimization mechanism, message transmission optimization mechanism) is also included ).
4. Compatibility
WCF fully considers compatibility with old systems. Installing WCF does not affect existing technologies such as asmx and. Net remoting. Even though both of them use soap, applications developed based on WCF can still directly interact with asmx.
Ii. Running Mechanism of WebService
First, the client claims a proxy class from the server to the WebService WSDL, and the client claims a proxy class. This proxy class is responsible for request and response with the WebService server, when a data (in XML format) when a data stream encapsulated into a SOAP format is sent to the server, a process object is generated and the soap packet that receives the request is parsed, and then processed, after the processing is complete, perform soap packaging on the computing result, and then send the package as a proxy class sent to the client as a response. Similarly, this proxy class also parses the soap package and then performs subsequent operations.
Iii. Net remoting
It is a technology developed on the basis of DCOM. Its main purpose is to implement cross-platform, cross-language, and enterprise firewall penetration, which is also its basic feature, different from WebService, WebService supports HTTP and TCP channels. It can not only transmit soap packets in XML format, but also transmit binary streams in the traditional sense, this makes it more efficient and flexible. In addition, it does not depend on IIS. Users can develop and deploy their own host servers (dispose). Therefore, WebService is actually used in these aspects. A special case of netemoting.
Differences:
1. remoting can flexibly define the Protocol it is based on, such as HTTP and TCP. If it is defined as HTTP, it is the same as Web service, but WebService is stateless, remoting is generally used to define TCP, which is a little more efficient and stateful than Web Services.
2. remoting is not a standard, whereas Web Service is a standard.
3. remoting generally needs to be started through a winform or Windows service, or you can use IIS for deployment, while web service must be started in IIS.
4. In the vs.net development environment, Web service calls are encapsulated, which is easier to use than remoting.
5. Net remoting can only be applied to Ms. net Framework, the client must install the framework, but the WebService is platform independent, cross-language (as long as the language can support XML) and penetrate the Enterprise Firewall.
Distributed Application Design: ASP. NET web service and. Net remoting
ASP. NET web services prefer XML Schema systems and provide simple programming models that are widely used across platforms .. Net remoting tends to be a runtime system and provides a more complex programming model with a much smaller scope. This essential difference is the main factor that determines which technology to use. However, there are many other design factors to consider, including transport protocols, host processes, security, performance, status management, and transaction support.
Transmission protocol and host process
Although the SOAP specification does not require HTTP as the transmission protocol, the client can only access ASP through HTTP. net web service, because it is an ASP. net supports the only transmission protocol. The service is called through IIS and executed in ASP. NET's auxiliary process aspnet_wp.exe.
. Net remoting allows you to flexibly host remote objects in any type of applications (including Windows Forms, hosted Windows Services, console applications, or ASP. NET auxiliary processes. As described earlier,. Net remoting provides two transmission channels: TCP and HTTP. Both channels can use sockets to provide communication between any sending and receiving processes.
It can also integrate the HTTP channel with IIS and ASP. NET auxiliary processes. This is important for the following reasons. First, it is the only way to automatically start the. NET remoting endpoint when the client requests arrive .. The net remoting pipeline does not include the DCOM-type Service Control Manager (SCM) required to start the remote server ). If remote objects are provided from any process, ensure that those processes are running. They must also be thread-safe. For example, thread a cannot activate an object after thread B Closes the process. If you provide remote objects from ASP. NET, you can use the aspnet_wp.exe auxiliary process to enable automatic start and thread security. Second, integration with IIS is the only way to ensure cross-process. Net remoting calls, as described in the following section.
ASP. NET web services and. Net remoting infrastructures are scalable. You can filter inbound and outbound messages to control the generation of type messages and metadata. With. Net remoting, you can also implement your own formatting programs and channels.
Security
Because ASP. NET web services depend on HTTP, they are integrated with the standard Internet security infrastructure. ASP. NET uses the security features of IIS to provide standard HTTP verification solutions (including basic, brief, digital certificates, and even Microsoft? . NET Passport) provides strong support. (Windows integration verification can also be used, but can only be used to trust clients in the domain .) One advantage of using the available HTTP verification scheme is that you do not need to change the code in the Web service. IIS performs verification before the ASP. NET web service is called. ASP. NET also supports. NET Passport-based authentication and other custom authentication schemes. ASP. NET supports access control based on the target URL, and supports access control through integration with the. NET code access security (CAS) infrastructure. SSL can be used to ensure communication security.
Although these standard transmission technologies are quite effective in ensuring web services, they can only do so. When multiple web services in different trust domains are involved, you must create custom special solutions. Microsoft and other companies are working to create a Security Specification that provides message-level security functions based on the scalability of soap messages. One of these specifications is the XML Web Service Security Language (WS-Security), which defines the framework for message-level credential transmission, message integrity, and message confidentiality.
As described in the previous section, the. NET remoting pipeline generally does not ensure the security of cross-process calls. Using ASP. NET to host. Net remoting endpoints in IIS, you can use all the security features available for ASP. NET web services, including support for SSL to ensure the security of wired communication. If you are using a TCP or HTTP channel (instead of aspnet_wp.exe) hosted in a process, you must perform authentication, authorization, and confidentiality on your own.
Another security issue to be concerned is the ability to execute code in an environment that is not fully trusted without changing the default security policy. ASP. NET web service client proxy can work in these environments, but. Net remoting proxy cannot. Special serialization permissions are required to use the. NET remoting proxy in an environment that is never fully trusted. By default, this permission is not granted to code downloaded from the Intranet or the Internet. If you want to use the. NET remoting client in an environment that is not fully trusted, you need to change the default security policy for the code loaded from those regions. When you connect to the system from a client running in a sandbox (such as a downloaded Windows Forms Application), ASP. NET web services are a simple choice because security policies do not need to be changed.
Status Management
By default, the ASP. NET web service model adopts a stateless service structure. It is not instinctively related to multiple calls from the same user. In addition, each time the client calls the ASP. NET web service, a new object is created to serve the request. After the method is called, the object is destroyed. To maintain the status between requests, you can use the same technology (for example, the session and application attribute packages) on the ASP. NET page, or customize the solution by yourself.
. Net remoting supports many state management options and may be related to or irrelevant to multiple calls from the same user, depending on the object lifecycle architecture you have selected. The singlecall object is stateless (for example, used to call ASP. net web service object). The singleton object shares the status of all clients, the objects activated by the client are kept in the State on the basis of each client (with all related issues of scalability and reliability ).
Performance
In terms of raw performance, the. NET remoting pipeline can provide the fastest communication when using TCP channels and binary formatting programs. In our comparison ASP.. NET web service and. in almost all tests of net remoting's relative performance, Asp. the performance of the Net web service exceeds that of the soap formatting program using the HTTP or TCP channel. net remoting endpoint. More interestingly, the performance of ASP. NET and. Net remoting endpoints using binary formatting programs is very similar to that of HTTP channels. (For more information, see Performance Comparison: Net remoting vs. ASP. NET web services .)
Enterprise Services
ASP. NET web services or objects provided through. Net remoting can use local transactions to coordinate work based on a single database. If you need to coordinate the work based on multiple resources, you can use the. NET Enterprise Service (also known as COM +) published transactions (DTC distributed transactions managed by COM + pipeline ). However, ASP. NET web services and. Net remoting pipelines cannot spread published transactions. Therefore, neither of these endpoints can inherit published transactions through cross-process calls.
This is not necessarily a bad thing. In general, published transactions are more costly than local transactions, and published transactions need to be spread across processes at a higher cost. If you need this function, the simple solution is in.. NET Enterprise Service server application to deploy. enterpriseservices. servicedcomponent-derived class (for more information, see COM + Integration: How. NET Enterprise Services can help you build distributed applications ). Cross-process calls to such objects are processed using DCOM to ensure correct propagation of the transaction environment. The more difficult solution is to use the underlying API to manually spread distributed transactions.
It is worth noting that the traditional distributed transaction model is generally not applicable to loosely coupled Web Services. The model based on compensation transactions (that is, revoking the transactions submitted by other firms) is more meaningful because the isolation constraints are not very strict. There is a common saying among web service providers, including Microsoft, that is, the more flexible the transaction model is required by the web service space, the more work is done in the space. When you define a standard method for Web service transactions, you can use local or published transactions as needed to implement your own compensation architecture.
Summary
Although both the. NET remoting infrastructure and ASP. NET web services can communicate across processes, each design is applicable to different users. ASP. NET Web Service provides a simple programming model and has a wide range of application .. Net remoting provides a more complex programming model with a much narrower scope. Be sure to understand how these two technologies work and select the technology that suits your application. In either case, IIS and ASP. NET are used to manage the process lifecycle and provide general security.
My remoting technology is also required by the project:
1. remoteing is mainly used for C/S structure projects.
2. Using remoting over TCP communication is not a little more efficient than Web service, but several times higher or even dozens of times. It is worthy of being developed based on DCOM and other technologies. For distributed applications across regions and even provinces (wide area networks), the efficiency means the survival of software systems.