Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the ways to enhance WCF services

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "what are the ways to enhance WCF services". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The system to be tested consists of a back-end WCF service and an ASP.NET Web application that uses the WCF service. WCF services are very flexible. One of the important design decisions when creating a WCF service is how to choose a hosting mechanism for the service.

There are four main methods: using IIS, using Windows ®Service, self-hosting, and using Windows Activation Service (WAS). You are probably familiar with using IIS and Windows Service.

Self-hosting involves hosting WCF within a program hosted by Microsoft ®.NET Framework, such as a console application. WAS is a new process activation mechanism provided in Windows Server ®2008 and Windows Vista ®. Each WCF hosting scheme has some advantages and disadvantages, depending on your specific development scenario.

In the WCF service example for this column, I decided to use IIS. This solution can take full advantage of some of the advantages of IIS, such as built-in integrated management and monitoring, process recycling, idle shutdown and message-based activation.

Creating a WCF service hosted by IIS is extremely simple. First, I activated Visual Studio ®2008 on Windows Server 2003. Note that if you decide to develop WCF services on a computer running Windows Server 2008 or Windows Vista, you must address some issues related to its enhanced security features during development. However, due to the limited space, I can not explain these issues here.

I only have a single operation GetCryptoHash here, but I can also add other actions. Note that the [SeviceContract] and [OperationContract] attributes do most of the actual code generation in the background. Then, by adding a using statement that references the System.Security.Cryptography namespace to edit the implementation file CryptoHashService.cs, I wrote the following code:

This is the end of [ServiceContract] public interface ICryptoHashService {[OperationContract] string GetCryptoHash (string s);} "what are the ways to enhance WCF services". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report