Tuesday, April 17, 2007

Command Prompt AutoComplete

From a command prompt pressing tab will auto complete a file name or folder. For example:

C:\>cd win (TAB) becomes cd windows
C:\WINDOWS>cd sys (TAB) becomes cd system32
C:\WINDOWS\SYSTEM32>cmd (TAB) becomes cmd.exe

Continuing to press tab cycles through all other files matching the pattern.

Long Running WebMethod

By default when you call a Web service method, the HTTP connection is held open until the WebMethod returns its value to the caller. In certain circumstances, where you may need to call a long running WebMethod where there is no return value it is appropriate to start the method processing and immediately return to the caller in a style similar to a "fire-and-forget" process.

By decorating the WebMethod with the attrbute [SoapDocumentMethod(OneWay=true)] , the server holds the HTTP connection open while it loads and parses the request message, but then returns immediately to the caller with an HTTP 202 response, indicating it has begun processing the request.

The disadvantage of this technique is that the consumer does not get any idea whether the method completed successfully or there were errors.

Note: By default, SOAP messages are in "document" style of formatting. If you are using Remote Procedure Call (RPC) formatting then use [SoapRpcMethod(OneWay=true)] instead of [SoapDocumentMethod(OneWay=true)].