<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: File Transfer with WCF</title>
	<atom:link href="http://stefanoricciardi.com/2009/08/28/file-transfer-with-wcp/feed/" rel="self" type="application/rss+xml" />
	<link>http://stefanoricciardi.com/2009/08/28/file-transfer-with-wcp/</link>
	<description>On Software Development and Thereabouts</description>
	<lastBuildDate>Mon, 30 Jan 2012 08:04:00 +0100</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Anonymous</title>
		<link>http://stefanoricciardi.com/2009/08/28/file-transfer-with-wcp/comment-page-2/#comment-638</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Mon, 09 Jan 2012 13:23:00 +0000</pubDate>
		<guid isPermaLink="false">http://stefanoricciardi.net/?p=318#comment-638</guid>
		<description>This has been asked and replied above. 
Cheers,
 Stefano </description>
		<content:encoded><![CDATA[<p>This has been asked and replied above.<br />
Cheers,<br />
 Stefano</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rockkyy</title>
		<link>http://stefanoricciardi.com/2009/08/28/file-transfer-with-wcp/comment-page-2/#comment-637</link>
		<dc:creator>Rockkyy</dc:creator>
		<pubDate>Mon, 09 Jan 2012 10:52:00 +0000</pubDate>
		<guid isPermaLink="false">http://stefanoricciardi.net/?p=318#comment-637</guid>
		<description>where is FileTypeEnum
FileTypeEnum??</description>
		<content:encoded><![CDATA[<p>where is FileTypeEnum<br />
FileTypeEnum??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pks</title>
		<link>http://stefanoricciardi.com/2009/08/28/file-transfer-with-wcp/comment-page-2/#comment-612</link>
		<dc:creator>Pks</dc:creator>
		<pubDate>Wed, 24 Aug 2011 15:27:00 +0000</pubDate>
		<guid isPermaLink="false">http://stefanoricciardi.net/?p=318#comment-612</guid>
		<description>Hi, I am interested to know if you can pass the stream across multiple WCF services i.e., read the file and create stream in asp.net - pass it to wcf service - this wcf service in turn passes it to another wcf service which saves it to file system. I have a similar type of requirement but I want to know if it is possible to stream across multiple wcf services without storing it in memory in every level.</description>
		<content:encoded><![CDATA[<p>Hi, I am interested to know if you can pass the stream across multiple WCF services i.e., read the file and create stream in asp.net &#8211; pass it to wcf service &#8211; this wcf service in turn passes it to another wcf service which saves it to file system. I have a similar type of requirement but I want to know if it is possible to stream across multiple wcf services without storing it in memory in every level.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://stefanoricciardi.com/2009/08/28/file-transfer-with-wcp/comment-page-2/#comment-605</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Thu, 28 Jul 2011 12:13:00 +0000</pubDate>
		<guid isPermaLink="false">http://stefanoricciardi.net/?p=318#comment-605</guid>
		<description>Hi, see my reply to this &lt;a href=&quot;http://stefanoricciardi.com/2009/08/28/file-transfer-with-wcp/#comment-95261016&quot; rel=&quot;nofollow&quot;&gt;comment&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Hi, see my reply to this <a href="http://stefanoricciardi.com/2009/08/28/file-transfer-with-wcp/#comment-95261016" rel="nofollow">comment</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tugberk</title>
		<link>http://stefanoricciardi.com/2009/08/28/file-transfer-with-wcp/comment-page-2/#comment-604</link>
		<dc:creator>tugberk</dc:creator>
		<pubDate>Thu, 28 Jul 2011 11:44:00 +0000</pubDate>
		<guid isPermaLink="false">http://stefanoricciardi.net/?p=318#comment-604</guid>
		<description>can you provide &#039;FileTypeEnum&#039; Enum code?</description>
		<content:encoded><![CDATA[<p>can you provide &#8216;FileTypeEnum&#8217; Enum code?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: razzi</title>
		<link>http://stefanoricciardi.com/2009/08/28/file-transfer-with-wcp/comment-page-2/#comment-560</link>
		<dc:creator>razzi</dc:creator>
		<pubDate>Thu, 03 Feb 2011 11:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://stefanoricciardi.net/?p=318#comment-560</guid>
		<description>a correct version of the DownloadFile method is this one:  

  public FileDownloadReturnMessage DownloadFile(FileDownloadMessage request)
    {
      Logger.AddLine(TraceLevel.Verbose, String.Format(&quot;Calling DownloadFile(FileDownloadMessage[ {0}, {1}]&quot;, request.FileMetaData.LocalFileName, request.FileMetaData.RemoteFileName));

      string localFileName = request.FileMetaData.LocalFileName;

      try
      {
        string serverFileName = request.FileMetaData.RemoteFileName;

        Stream fs = new FileStream(serverFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

        // Streams should always be closed after usage to free the resources behind them. 
        // WCF web service functions returning values like streams are no exception. You should never rely on your client to do this 
        // Using the OperationCompleted event, we handle the disposal of the streal
        OperationContext clientContext = OperationContext.Current;
        clientContext.OperationCompleted += new EventHandler(delegate(object sender, EventArgs args)
        {
          if (fs != null)
            fs.Dispose();
        });

        return new FileDownloadReturnMessage(new FileMetaData(localFileName, serverFileName), fs);
      }
      catch (Exception e)
      {
        Logger.AddLine(TraceLevel.Error, e.Message);
        FileAccessFault fault = new FileAccessFault();
        fault.AdditionalDetails = e.Message;
        throw new FaultException(fault);
      }
    }
</description>
		<content:encoded><![CDATA[<p>a correct version of the DownloadFile method is this one:  </p>
<p>  public FileDownloadReturnMessage DownloadFile(FileDownloadMessage request)<br />
    {<br />
      Logger.AddLine(TraceLevel.Verbose, String.Format(&#8220;Calling DownloadFile(FileDownloadMessage[ {0}, {1}]&#8220;, request.FileMetaData.LocalFileName, request.FileMetaData.RemoteFileName));</p>
<p>      string localFileName = request.FileMetaData.LocalFileName;</p>
<p>      try<br />
      {<br />
        string serverFileName = request.FileMetaData.RemoteFileName;</p>
<p>        Stream fs = new FileStream(serverFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);</p>
<p>        // Streams should always be closed after usage to free the resources behind them.<br />
        // WCF web service functions returning values like streams are no exception. You should never rely on your client to do this<br />
        // Using the OperationCompleted event, we handle the disposal of the streal<br />
        OperationContext clientContext = OperationContext.Current;<br />
        clientContext.OperationCompleted += new EventHandler(delegate(object sender, EventArgs args)<br />
        {<br />
          if (fs != null)<br />
            fs.Dispose();<br />
        });</p>
<p>        return new FileDownloadReturnMessage(new FileMetaData(localFileName, serverFileName), fs);<br />
      }<br />
      catch (Exception e)<br />
      {<br />
        Logger.AddLine(TraceLevel.Error, e.Message);<br />
        FileAccessFault fault = new FileAccessFault();<br />
        fault.AdditionalDetails = e.Message;<br />
        throw new FaultException(fault);<br />
      }<br />
    }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://stefanoricciardi.com/2009/08/28/file-transfer-with-wcp/comment-page-2/#comment-555</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Tue, 25 Jan 2011 08:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://stefanoricciardi.net/?p=318#comment-555</guid>
		<description>Raghu,

as you can see from the number of replies I have made in this post, I *am* trying to help. However this is just a personal blog and not a question &amp; answer site (like, say, StackOverflow).

I have presented here a possible solution to a problem (sending files via WCF), hoping that this would inspire other people with similar problems. I am not a Microsoft MVP.

It seems, though, that you need something more and you expect me to provide the solution to your specific problem. I don&#039;t have code ready to solve it and it would take me hours just to understand your scenario, put the code together and test it until it works correctly.</description>
		<content:encoded><![CDATA[<p>Raghu,</p>
<p>as you can see from the number of replies I have made in this post, I *am* trying to help. However this is just a personal blog and not a question &amp; answer site (like, say, StackOverflow).</p>
<p>I have presented here a possible solution to a problem (sending files via WCF), hoping that this would inspire other people with similar problems. I am not a Microsoft MVP.</p>
<p>It seems, though, that you need something more and you expect me to provide the solution to your specific problem. I don&#8217;t have code ready to solve it and it would take me hours just to understand your scenario, put the code together and test it until it works correctly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: raghu</title>
		<link>http://stefanoricciardi.com/2009/08/28/file-transfer-with-wcp/comment-page-2/#comment-553</link>
		<dc:creator>raghu</dc:creator>
		<pubDate>Mon, 24 Jan 2011 16:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://stefanoricciardi.net/?p=318#comment-553</guid>
		<description>Dear Stefano , 

I think you would like to just write a word a two if some one makes some post. Not interested to solve their exact problem. Please intimate what is the use of providing a provision to post a comment when you are not interested to provide some sort of solution. 

I have been waiting for your response for the past one week.
 If you are not interested to post anything,  Please remove this comment box altogether and just share your experience. 

</description>
		<content:encoded><![CDATA[<p>Dear Stefano , </p>
<p>I think you would like to just write a word a two if some one makes some post. Not interested to solve their exact problem. Please intimate what is the use of providing a provision to post a comment when you are not interested to provide some sort of solution. </p>
<p>I have been waiting for your response for the past one week.<br />
 If you are not interested to post anything,  Please remove this comment box altogether and just share your experience.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 07raghuram</title>
		<link>http://stefanoricciardi.com/2009/08/28/file-transfer-with-wcp/comment-page-2/#comment-549</link>
		<dc:creator>07raghuram</dc:creator>
		<pubDate>Wed, 12 Jan 2011 05:05:00 +0000</pubDate>
		<guid isPermaLink="false">http://stefanoricciardi.net/?p=318#comment-549</guid>
		<description>I am new in this technology could you please provide small hint how to achieve this.

</description>
		<content:encoded><![CDATA[<p>I am new in this technology could you please provide small hint how to achieve this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefano Ricciardi</title>
		<link>http://stefanoricciardi.com/2009/08/28/file-transfer-with-wcp/comment-page-2/#comment-547</link>
		<dc:creator>Stefano Ricciardi</dc:creator>
		<pubDate>Mon, 10 Jan 2011 13:43:00 +0000</pubDate>
		<guid isPermaLink="false">http://stefanoricciardi.net/?p=318#comment-547</guid>
		<description>Raghu,
that is certainly possible. You need to extend the service with a new operation contract and a message contract to suite your needs.</description>
		<content:encoded><![CDATA[<p>Raghu,<br />
that is certainly possible. You need to extend the service with a new operation contract and a message contract to suite your needs.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

