- ServiceStack
- Transport is http only: http://www.servicestack.net/overview.htm
- NServiceBus
- Default transport is MSMQ, but others can be plugged in
- Agatha
- Use WCF for transport
- Why not WCF: http://thatextramile.be/blog/2009/07/why-i-dislike-classic-or-typical-wcf-usage
- no longer in active development
Tuesday, November 13, 2012
WCF alternatives
Monday, November 5, 2012
WCF Extension
MSDN link
http://msdn.microsoft.com/en-us/library/gg132853.aspx (MS document, not very good)
http://blogs.msdn.com/b/drnick/archive/2006/05/08/592110.aspx (Very good step-by-step blog)
-> improved and source code: http://blogs.msdn.com/b/dmetzgar/archive/2012/10/16/an-updated-custom-wcf-transport-channel-example.aspx
-> tcp example: http://code.msdn.microsoft.com/windowsdesktop/Sample-WCF-transport-474c4c02
Configuring custom binding:
- http://msdn.microsoft.com/en-us/library/ms788753.aspx
- http://msdn.microsoft.com/en-us/library/ms788759(v=vs.110).aspx
- http://robbincremers.me/2012/01/01/wcf-custom-binding-by-configuration-and-by-binding-standardbindingelement-and-standardbindingcollectionelement/
http://msdn.microsoft.com/en-us/library/dd699779.aspx (WCF example document)
http://blogs.msdn.com/b/carlosfigueira/archive/2011/12/08/wcf-extensibility-transport-channels-request-channels-part-1.aspx
http://msdn.microsoft.com/en-us/magazine/cc163302.aspx
http://msdn.microsoft.com/en-us/magazine/cc163394.aspx
http://blogs.msdn.com/b/drnick/archive/2006/05/08/592110.aspx (Very good step-by-step blog)
-> improved and source code: http://blogs.msdn.com/b/dmetzgar/archive/2012/10/16/an-updated-custom-wcf-transport-channel-example.aspx
-> tcp example: http://code.msdn.microsoft.com/windowsdesktop/Sample-WCF-transport-474c4c02
Configuring custom binding:
- http://msdn.microsoft.com/en-us/library/ms788753.aspx
- http://msdn.microsoft.com/en-us/library/ms788759(v=vs.110).aspx
- http://robbincremers.me/2012/01/01/wcf-custom-binding-by-configuration-and-by-binding-standardbindingelement-and-standardbindingcollectionelement/
http://msdn.microsoft.com/en-us/library/dd699779.aspx (WCF example document)
http://blogs.msdn.com/b/carlosfigueira/archive/2011/12/08/wcf-extensibility-transport-channels-request-channels-part-1.aspx
http://msdn.microsoft.com/en-us/magazine/cc163302.aspx
http://msdn.microsoft.com/en-us/magazine/cc163394.aspx
Example
http://wcfextensions.codeplex.com/http://webservices20.blogspot.jp/2008/11/introducing-wcf-clearusernamebinding.html
http://www.microsoft.com/en-us/download/details.aspx?id=21459
Tutorial
Writing channels: http://blogs.msdn.com/b/drnick/archive/2007/02/19/channel-development-tour-part-1.aspx
Class Diagram
Friday, November 2, 2012
How Fiddler works
Fiddler inserting itself as system proxy, see: http://msdn.microsoft.com/en-us/library/bb250446(v=vs.85).aspx
Thursday, October 25, 2012
WCF Performance
Thread pool throttling
Antivirus slowdown
Monday, October 15, 2012
Async/Await
Using Async/Await from .NET 4.0
* Download from http://nuget.org/packages/Microsoft.CompilerServices.AsyncTargetingPack
* License is here http://www.microsoft.com/en-us/download/details.aspx?id=29576
Using TPL to implement APM
* http://blogs.msdn.com/b/pfxteam/archive/2011/06/27/using-tasks-to-implement-the-apm-pattern.aspx
Synchronization Contexts in UI, Console, ASP.NET etc
* http://msdn.microsoft.com/en-us/magazine/gg598924.aspx
When used on UI application, the code after "await" is executed by UI thread by default. In Console application however, we need special treatments. See:
1. http://blogs.msdn.com/b/pfxteam/archive/2012/01/20/10259049.aspx
2. http://blogs.msdn.com/b/pfxteam/archive/2012/01/21/10259307.aspx
3. http://blogs.msdn.com/b/pfxteam/archive/2012/02/02/10263555.aspx
* Download from http://nuget.org/packages/Microsoft.CompilerServices.AsyncTargetingPack
* License is here http://www.microsoft.com/en-us/download/details.aspx?id=29576
Using TPL to implement APM
* http://blogs.msdn.com/b/pfxteam/archive/2011/06/27/using-tasks-to-implement-the-apm-pattern.aspx
Synchronization Contexts in UI, Console, ASP.NET etc
* http://msdn.microsoft.com/en-us/magazine/gg598924.aspx
When used on UI application, the code after "await" is executed by UI thread by default. In Console application however, we need special treatments. See:
1. http://blogs.msdn.com/b/pfxteam/archive/2012/01/20/10259049.aspx
2. http://blogs.msdn.com/b/pfxteam/archive/2012/01/21/10259307.aspx
3. http://blogs.msdn.com/b/pfxteam/archive/2012/02/02/10263555.aspx
Friday, October 12, 2012
WCF: Windows Communication Foundation
SelfHosting tutorial
http://msdn.microsoft.com/en-us/library/ms731758.aspxHow to publish metadata when using TCP binding:
1. Inside app.config, create service behavior element (e.g. HelloServiceBehavior)
2. Refer the behavior from service tag (behaviorConfiguration="HelloServiceBehavior")
3. Add endpoint to the service to exchange metadata, use contract="IMetadataExchange".
<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="HelloServiceBehavior"> <serviceMetadata policyVersion="Policy15" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> <services> <service behaviorConfiguration="HelloServiceBehavior" name="HelloService"> <endpoint address="net.tcp://localhost:8080/hello" binding="netTcpBinding" bindingConfiguration="" name="HelloService" contract="IHelloService" /> <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" /> </service> </services> </system.serviceModel> </configuration>
Using Async/Await
Async Cancellation/Progress is not supported
http://social.msdn.microsoft.com/Forums/en-US/async/thread/b1353952-ce52-4af7-b6ec-f792bef28566/
Enabling trace
netTcpBinding uses binary encoding and transport security, which delivers better performance.
Following URLS will help to get more information
Client proxy cannot be reused: http://stackoverflow.com/questions/1241331/recovering-from-a-communicationobjectfaultedexception-in-wcf
Solution: http://bloggingabout.net/blogs/erwyn/archive/2006/12/09/WCF-Service-Proxy-Helper.aspx
Solution: http://bloggingabout.net/blogs/erwyn/archive/2006/12/09/WCF-Service-Proxy-Helper.aspx
Classes
ServiceContractAttribute: http://msdn.microsoft.com/en-us/library/system.servicemodel.servicecontractattribute.aspx
OperationContractAttribute: http://msdn.microsoft.com/en-us/library/system.servicemodel.operationcontractattribute.aspx
ServiceBehaviorAttribute: http://msdn.microsoft.com/en-us/library/system.servicemodel.servicebehaviorattribute.aspx
Performance
Concurrency and Throttling combinations http://www.codeproject.com/Articles/89858/WCF-Concurrency-Single-Multiple-and-Reentrant-and
Timeout
Open/Close/Send/Receive/Operation: http://cs.gogo-asp.net/blogs/libaty/archive/2009/11/02/WCF_6730E930A630F330C930C830EA30C330D7306E30BF30A430E030A230A630C830245092302D8A9A5B59308B306B306F30_.aspx
Detecting Disconnected Clients
http://stackoverflow.com/questions/665473/how-to-handle-wcf-client-disconnect
http://stackoverflow.com/questions/5338842/detect-socket-disconnect-in-wcf
http://stackoverflow.com/questions/5338842/detect-socket-disconnect-in-wcf
Reliable Messaging
Need to turn-off or set level to Message Security for Bindings (doesn't work if the level is set to the default Transport level)
Working case
- Server not available during the first connection
- Network cable is blipping
Not working case
- Server is down and restarted
WCF and WebSocket
WebSocket only available in Windows8 ? (http://msdn.microsoft.com/en-us/library/system.servicemodel.nethttpbinding.aspx)
http://msdn.microsoft.com/en-us/library/hh977020.aspx
http://www.codeproject.com/Articles/341413/What-s-new-in-WCF-4-5-WebSocket-support-Part-2-of
http://msdn.microsoft.com/en-us/library/hh977020.aspx
http://www.codeproject.com/Articles/341413/What-s-new-in-WCF-4-5-WebSocket-support-Part-2-of
Performance Tuning
http://blogs.msdn.com/b/dmetzgar/archive/2011/05/04/wcf-scales-up-slowly-with-bursts-of-work.aspx
Multiple Contract per Service
Example
Thursday, October 11, 2012
Monday, October 1, 2012
.NET Async Await
* Performance consideration: http://msdn.microsoft.com/en-us/magazine/hh456402.aspx
* Comparison with old patterns: http://msdn.microsoft.com/en-us/library/jj152938.aspx
* Comparison with old patterns: http://msdn.microsoft.com/en-us/library/jj152938.aspx
,NET timers
Comparisons: http://msdn.microsoft.com/en-us/magazine/cc164015.aspx
Note that System.Timers.Timer and System.Threading.Timer by default call your timer event handler on a worker thread obtained from the common language runtime (CLR) thread pool.
Note that System.Timers.Timer and System.Threading.Timer by default call your timer event handler on a worker thread obtained from the common language runtime (CLR) thread pool.
System.Windows.Forms | System.Timers | System.Threading | |
---|---|---|---|
Timer event runs on what thread? | UI thread | UI or worker thread | Worker thread |
Instances are thread safe? | No | Yes | No |
Familiar/intuitive object model? | Yes | Yes | No |
Requires Windows Forms? | Yes | No | No |
Metronome-quality beat? | No | Yes* | Yes* |
Timer event supports state object? | No | No | Yes |
Initial timer event can be scheduled? | No | No | Yes |
Class supports inheritance? | Yes | Yes | No |
* Depending on the availability of system resources (for example, worker threads) |