Tuesday, November 17, 2009

WCF - Basic design considerations.

Here is a list of items to consider while designing a WCF web service. These are based on many reference articles including msdn and based on my current exposure and experience to WCF.

It is important to understnad teh WCF framework and options it offers. Implemetnation is the easiest part. These may change as per your requirement.

WCF Decision Points

Security

Security Modes:

Available Options:
• None. Turns security off.
• Transport. Uses transport security for mutual authentication and message protection.
• Message. Uses message security for mutual authentication and message protection.
• Both. Allows you to supply settings for transport and message-level security (only MSMQ supports this).
• TransportWithMessageCredential. Credentials are passed with the message and message protection and server authentication are provided by the transport layer.
• TransportCredentialOnly. Client credentials are passed with the transport layer and no message protection is applied

Recommended Options

• Message security mode, on the other hand, uses WS-Security (and other specifications) to implement transfer security. Because the message security is applied directly to the SOAP messages and is contained inside the SOAP envelopes, together with the application data, it has the advantage of being transport protocol-independent, more extensible, and ensuring end-to-end security (versus point-to-point); it has the disadvantage of being several times slower than transport security mode because it has to deal with the XML nature of the SOAP messages.
• Transport security mode uses a transport-level protocol, such as HTTPS, to achieve transfer security. Transport mode has the advantage of being widely adopted, available on many platforms, and less computationally complex. However, it has the disadvantage of securing messages only from point-to-point.

Client Credential Type

Following options are based on the type of bindings used.

Recommended Options
• Windows
• UserName
• Certificate

Recommended Protection Level: EncryptAndSign

Recommended Bindings: WsHttpBinding

There are many options available which can be configured at a later stage. Some of the recommended Bindings in addition to WsHttpBinding are given below. These can be configured as different endpoints when it is required.

- NetTcpBinding
- NetNamedPipeBinding
- NetMsmqBinding

Hosting

Available Options:

- Self Hosted
- Windows Service
- IIS 5.1, 6.0, 7.0 (Depends on versions of OS)
- WAS (works only on Vista or Windows 2008)

Recommended

- IIS
o 6.0 on windows server 2003
 Process recycling.
 Idle shutdown.
 Process health monitoring.
 Message-based activation.
 Recycling
 HTTP only
o 7.0 or WAS on windows server 2008
 Same benefits as 5.1 and 6.0
 HTTP, TCP, Named Pipes and MSMQ
- Windows Service
o Service process lifetime controlled by the operating system, not message-activated.
o Supported by all versions of Windows.
o Secure environment.
o Supports HTTP, TCP, Named Pipes and MSMQ
o Deployment: Services must be installed with the .NET Framework Installutil.exe utility or through a custom action in an installer package.




Message Contracts

Following are some benefits of using Message Contracts instead of directly using Data Contracts.

- More controls over the SOAP Messages
- Easier to update the Operation signatures like additional parameters during before any version of WCF service is released.
- More control over how WSDL is generated.


Recommendation:

Consider using Message Contracts based on business need.


Instance Management
Per-Call services are most preferred for scalability.

Operations
Request-Reply operations are preferred rather than call back or one way operations.

Faults
Fault contract details to be decided during design time.

Transactions
Recommended transaction settings if not a distributed environment is [TransactionFlow(TransactionFlowOption.NotAllowed)]

Concurrency Management
Use default ConcurrencyMode.Single and leave thread synchronization to WCF. This is recommended along with Per-Call instantiation.
Versioning
Versioning needs to be done. Details to be decided during design phase.

Logging
Use existing Logging mechanisms used in your apps or use Log4Net.

Out of the box WCF Client Proxies

Following proxies can be provided to customers for easy development
- .Net proxy
- Java proxy

38 comments:

  1. 人必須心懷希望,才會活的快樂,日子才過得充實,有意義,有朝氣,有信心。........................................

    ReplyDelete
  2. 援交女豆豆出租情人視訊sogo論壇視訊辣妹桃園兼職援交辣妹視訊一對一視訊520sex日本視訊小魔女自拍av1688影音娛樂網辣手美眉甜心寶貝直播貼片免費色咪咪視訊網pc交友視訊美女ggoo免費視訊情色網咆哮小老鼠高雄援交夢中情人情趣用品sex888免費看影片波霸美女寫真sex888免費看影片視訊新竹援交留言0401成人聊天室甜心寶貝貼影片援交友留言桃園sogo 論壇080情人網視訊泳裝秀拓網交友色美眉免費看視訊免費色咪咪影片網 兼職援交聊天室ilover99a片天堂卡通aa片台灣情色網無碼avdvd色色網sexy diamond sex888入口高雄視訊辣妹自拍免費a片亞洲東洋影片hilive本土自拍天堂西門慶成人論壇 費 aaa 片試看dudu sex免費影片avdvd一夜情色妹妹免費情慾影片觀賞qq美美色網影片av免費影片日本 a 片自拍偷拍網站情色小說jp成人a 片日本avdvd女優xxx383美女寫真日本avdvd小魔女免費影城無碼avdvd無碼卡通情色情色論壇甜心寶貝貼片區Show-live視訊聊天室 情色免費A片情色偷拍免費A片一本道 a片 東京熱avdvd影片色美眉台中援交aa 片試看aaa 片試看情人輔助品成人網站做愛自拍偷拍免費試看av免費成人電影dudu sex免費 aa 片試看臺灣情色網線上免費a長片0204免費a片試看a片免費試看a片天堂台灣論壇成人a漫畫免費視訊聊天ing免費視訊美女aaa影片下載城卡通aa片免費看成人影片分享視訊聊天評比104免費成人情色文學小說

    ReplyDelete
  3. hello~welcome my world~<. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    ReplyDelete
  4. 一定要保持最佳狀況呦,加油!!!期待你發表的新文章!.............................................

    ReplyDelete
  5. Pen and ink is wits plough. .................................................................                           

    ReplyDelete
  6. 在莫非定律中有項笨蛋定律:「一個組織中的笨蛋,恆大於等於三分之二。」....................................................................

    ReplyDelete
  7. 當一個人內心能容納兩樣相互衝突的東西,這個人便開始變得有價值了。............................................................

    ReplyDelete
  8. 向著星球長驅直進的人,反比踟躕在峽路上的人,更容易達到目的。............................................................

    ReplyDelete
  9. 要在憂患恥辱的環境裡,創造我們自力更生的新生活。..................................................

    ReplyDelete
  10. 真正仁慈的人,會忘記他們做過的善行,他們全心投入現在的工作,過去的事已被遺忘。.................................................

    ReplyDelete
  11. 我們必須先有哭泣,才有歡笑;也必須先感到人生的悲哀,然後才感到人生的快樂。................................................................

    ReplyDelete