To modify properties that are not exposed on the standard binding we can create a CustomBinding from the provided standard binding. We can then find the element required on the particular CustomBinding and tweak it. Another option would be to just hand craft the full standard binding if you know exactly how to stack up the elements. Here is an example to how to tweek the IdleTimeout.
private static CustomBinding GetIdleBinding(int mins)
{
NetTcpBinding tcpBinding = new NetTcpBinding();
CustomBinding customBinding = new CustomBinding(tcpBinding);
TcpTransportBindingElement transport = customBinding.Elements.Find();
transport.ConnectionPoolSettings.IdleTimeout = TimeSpan.FromMinutes(mins);
return customBinding;
}
Published on
Jul 12'10 in
Work.
Tags: dos.
ErrorLevel is not %ERRORLEVEL% . This is probably the first one you should read.
Next is the usage of the ERRORLEVEL statement. http://support.microsoft.com/kb/69576
The following table shows the effect of statement when writing your batch scriipt.
| Statement |
Algebraic Equivalent. |
| IF ERRORLEVEL 5 … |
IF E = 5 OR E > 5 THEN … |
| IF NOT ERRORLEVEL 6 |
IF E < 6 THEN … |
Here is a sample using findstr and error level. Findstr returns 0 if it successfully finds any occurrence.
findstr -sip Failed log.txt > NULL
IF NOT ERRORLEVEL 1 (
echo Found.
) else (
echo Not Found.
)
Published on
Jun 25'10 in
Work.
Tags: dos.
If you ever wanted to copy over a really long multiline dos command or output, what would you usually do?
- Copy it line by line (after enabling quick edit mode of course)
- Pipe the output to a text file
- … Any other round about way ?
You could just try this little utility called clip.exe, if you haven’t tried it already.

Here is a script to quickly create and delete queues. This was based out of this post.
Usage :
CreateQueue.ps1 <-c,d> <queuename> <Y/N – Private> <user> <all:restricted Permission> [T:Transactional]
Download CreateQueue.ps1
WCF gives a very rich set of standard bindings that you can use for your endpoints. However we might need to tweak properties that might not be exposed on the standard bindings. You can handcraft the whole binding or you can start with standard binding as a template. Here are some ways.
- Create the BindingElementCollection from the StandardBinding and update properties on it and use the BindingElementCollection to create the CustomBinding. This creates a full clone of binding elements and you can reset values on the elements using Find<BindingElement> on the collection.
- Create the CustomBinding directly from the StandardBinding by passing the binding into the CustomBinding constructor. The first approach has an issue where properties like SendTimeout/ReceiveTimeout etc don’t get copied onto the CustomBinding since they are held by the Binding and not its child elements & for this simple reason would recommend the second approach.
[code:c#]
BasicHttpBinding httpBinding = new BasicHttpBinding();
httpBinding.SendTimeout = TimeSpan.FromSeconds(123);
Console.WriteLine(httpBinding.ToString());
BindingElementCollection bec = httpBinding.CreateBindingElements();
bec.Find<HttpTransportBindingElement>().KeepAliveEnabled = false;
CustomBinding copy1 = new CustomBinding(bec);
Console.WriteLine("SendTimeout = {0} KeepAliveEnabled = {1}",
copy1.SendTimeout,
copy1.Elements.Find<HttpTransportBindingElement>.KeepAliveEnabled);
CustomBinding copy2 = new CustomBinding(httpBinding);
copy2.Elements.Find<HttpTransportBindingElement>.KeepAliveEnabled = false;
Console.WriteLine("SendTimeout = {0} KeepAliveEnabled = {1}",
copy2.SendTimeout,
copy2.Elements.Find<HttpTransportBindingElement>().KeepAliveEnabled);
[/code]
An easy way for getting performance and diagnostic information. You can quickly collect etw/minidumps vmmaps etc.
http://visualstudiogallery.msdn.microsoft.com/en-us/e8649e35-26b1-4e73-b427-c2886a0705f4
This is the command you can use to do an automated 5 second network capture using netmon for default net.tcp traffic on any stack such as wcf or Sapphire. The default net.tcp port is 808 so thats what we use here.
[code:c#] nmcap /network * /capture tcp.port == 808 /startwhen /timeafter 0 sec /stopwhen /timeafter 5 sec /file output.cap [/code]
- You can download network monitor from here
- Check out this post incase you are not aware of nmcap.
Here are some quick walkthroughs on how you can write native services and consume web services natively.
For the samples you can get the Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1
Published on
Nov 24'09 in
Work.
Tags: pdc, wf.
Here was an interesting set of questions comparing WCF & WWS
1) With .NET 4.0, are we going to see any improvement to close the gap?
2) There seems very little information about this except on Channel 9 or various blogs. Are we going to see more information?
3) Is there a way to get the best of both WWS and .NET in a typical application? For example, use WWS for the web service API for
Here is the reply from Bob (our Product Unit Manager)
WCF and Windows Web Services (WWS) are complementary technologies. WCF is the premier Web Services stack to use when writing managed applications; if you are writing native code and want a SOAP stack then definitely use the WWSAPI. Introducing a native SOAP stack underscores our commitment to interop and WS-*. WWSAPI supports a subset of WS-* and is not as full featured or extensible as WCF. It definitely has a smaller footprint than WCF and it also has higher throughput for the scenarios it supports. This is due to a reduced feature set and implementation in native code. It also interops on the wire with WCF.
To answer the specific questions below:
- The current performance of WCF is industry leading. Please see the link for comparison with WebSphere where WCF easily outperforms the competition: http://download.microsoft.com/download/4/8/6/486B4B4F-5A87-4B5C-BEEC-455290F83274/IBMPower570_WebSphere_7_%20NET_Benchmark_WinSrv2008.pdf
- For most WCF scenarios .NET 4 performance is similar, or slightly better than, WCF perf in .NET 3.5 SP1
- The article references does not show WWSAPI to be 10X faster than WCF (as the customer claims); it does show the working set of WWS (native) to be 0.5-1MB compared to 4.5MB for WCF (managed/.NET). Server throughput is also better for WWS than WCF, but as noted above, WCF is already industry leading. The fact that a highly tuned, native, less-feature-rich SOAP stack has higher server throughput on ping-like service is not concerning. The cost of any realistic service will dwarf the infrastructure cost of either WCF or WWS. Put another way, either stack should meet the performance needs of a service and the deciding factor should be whether you require a native or managed solution.
- The article does not state that most teams in MS are moving to WWSAPI as the customer notes. What is happening is that those teams which require a native SOAP stack can move to WWSAPI; the majority however are using WCF as they are managed.
- Finally, trying to wrap or PInvoke between the two is not recommended. If you are writing managed code use WCF; if you are writing native code use WWSAPI.