Schedule a Task to pull files from sFTP Server

Files from sFTP server can be downloaded to the local system easily using the free tool such as winscp.

1. Download WinSCP From here

WinSCP :: Download

2. Install WinScp to the client machine

3. Copy the below script and paste in a text file called “sFTP_Script.txt” and place it in C:\sFTPPull folder you wish

# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open s -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
# Connect
open s -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
# Change remote directory
cd /
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
get *.txt c:\
# Disconnect

4. Either you can download file using command line or by scheduling a task in Windows Task Scheduler.

5. Command line is :-

C:\ProgramFiles\WinSCP\WinSCP.exe /console  /script="C:\sFTPPull \sFTP_ Script.txt"

6. The File would be written to C:\ drive, but it can be changed to the destination folder you wish by editing the “get *.txt C:\ “ line.

Articles Referred :-



Serializing & Deserializing a object

Convert Object to String

Class c1 = new Class();
c1.Name = "Chemistry";
XmlSerializer xmlSerializer = new XmlSerializer(typeof(Class));
StringWriter stringWriter = new StringWriter();
xmlSerializer.Serialize(stringWriter, c1);
string serializedXML = stringWriter.ToString();

Convert Object to XMLDocument

            Class c1 = new Class();
            c1.Name = "Chemistry";
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(Class));
            MemoryStream memStream = new MemoryStream();
            StreamWriter streamWriter = new StreamWriter(memStream);
            xmlSerializer.Serialize(streamWriter, c1);
            memStream.Position = 0;
            StreamReader streamReader = new StreamReader(memStream);
            XmlDocument serializedXML = new XmlDocument();

Convert String to Object

Class c1 = new Class();
XmlSerializer xmlSerializer = new XmlSerializer(c1.GetType());
StringReader stringReader = new StringReader(strValue);
c1= xmlSerializer.Deserialize(stringReader);

Making an Asyncronous call to WebService

Server Side Code


public String HelloWorld(string name)

{ return "Hello " + name; }

Client Side Code

public void TestHelloWorld_Async()


MyWebService.Service client = new MyWebService.Service(); client.HelloWorldCompleted += new HelloWorldCompletedEventHandler(this.ProcessAsyncCompleted);

client.HelloWorldAsync(“James Bond”);


private void ProcessAsyncCompleted(object sender, AuthenticateSenderCompletedEventArgs args)

{ object i = args.Result; }

The Control would come to ProcessAsyncCompleted after the execution of the webmethod.


Refer :-

Learning AppFabric

Interested in learning Windows Server AppFabric? I hope so. It will be the backbone of the on-premise version of BizTalk in the coming years and based on news out of the PDC it looks like it will be moving to Azure (in some form) as well.

There are many resources out there for learning Windows Server AppFabric. However, not all of them are equal and you can spend a lot of time meandering through material without making a lot of progress.

Below is my suggested path for coming up to speed on it with the least amount of effort. First, you need to be familiar with some foundation items:

  • There are new features in WCF 4.0. This whitepaper is a great way to become familiar with it:
    • One thing to keep in mind is that not all of the concepts are that relevant to Windows Server AppFabric. Focus on the new configuration features if you don’t have a lot of time.
  • Also note that both of the whitepapers mentioned above have sections on Workflow Services. Workflow Services existed in .NET 3.5 but have been improved in .NET 4.0.
  • You must also understand IIS 7.0/7.5. If you are not familiar with it, head on over to You’ll need to be familiar with things like Sites, ApplicationPools, Applications, AutoStart, Bindings, MSDeploy, hierarchical configuration with web.configs, etc.

Now you have the foundation you need to start learning about Windows Server AppFabric. This foundation is very important because if you don’t have it, you won’t be able to understand what Windows Server AppFabric is bringing to the table. It will also be more difficult to troubleshoot with out this foundation.

After you have the foundation items covered move on to learning about AppFabric itself:

That’s a lot of material. You will not be an expert after this but you should have a solid understanding of Windows Server AppFabric and be able to use it.