資源簡介
利用WCF實現文件傳送,主要注意MessageContract的使用
本示例的主要功能 就是 client.exe通過wcf 將本機的 sample.docx文件傳輸到 server.exe端
親測通過了
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?System.ServiceModel;
using?StreamServiceSln;
using?System.IO;
namespace?Client
{
????class?Program
????{
????????static?void?Main(string[]?args)
????????{
????????????using?(SProxy?p?=?new?SProxy())
????????????{
????????????????string?strPath?=?System.IO.Path.GetDirectoryName(new?Uri(typeof(Program).Assembly.Codebase).LocalPath)?+?“\\“?+?“sample.docx“;
????????????????//strPath?=@“E:\sample.docx“;
????????????????using?(FileStream?instream?=?new?FileStream(strPath?FileMode.Open))
????????????????{
????????????????????p.Upload(instream?“sample.docx“);
????????????????}
????????????}
????????????Console.WriteLine(“OK“);
????????????Console.ReadKey();
????????}
????}
??
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-06-24?22:01??Client\
?????文件?????????942??2016-06-05?22:28??Client\App.config
?????目錄???????????0??2016-06-05?20:39??Client\bin\
?????目錄???????????0??2016-06-24?22:01??Client\bin\Debug\
?????文件????????5632??2016-06-24?22:01??Client\bin\Debug\Client.exe
?????文件?????????942??2016-06-05?22:28??Client\bin\Debug\Client.exe.config
?????文件???????15872??2016-06-24?22:01??Client\bin\Debug\Client.pdb
?????文件???????22688??2016-06-24?18:04??Client\bin\Debug\Client.vshost.exe
?????文件?????????942??2016-06-05?22:28??Client\bin\Debug\Client.vshost.exe.config
?????文件?????????490??2015-10-30?15:19??Client\bin\Debug\Client.vshost.exe.manifest
?????文件?????2724746??2016-06-24?22:01??Client\bin\Debug\sample.docx
?????文件????????6656??2016-06-24?22:01??Client\bin\Debug\StreamServiceSln.dll
?????文件???????19968??2016-06-24?22:01??Client\bin\Debug\StreamServiceSln.pdb
?????文件????????2955??2016-06-24?22:01??Client\Client.csproj
?????目錄???????????0??2016-06-05?20:39??Client\obj\
?????目錄???????????0??2016-06-24?22:01??Client\obj\Debug\
?????文件????????1718??2016-06-24?22:01??Client\obj\Debug\Client.csproj.FileListAbsolute.txt
?????文件????????7441??2016-06-24?22:01??Client\obj\Debug\Client.csprojResolveAssemblyReference.cache
?????文件????????5632??2016-06-24?22:01??Client\obj\Debug\Client.exe
?????文件???????15872??2016-06-24?22:01??Client\obj\Debug\Client.pdb
?????文件????????6949??2016-06-24?22:01??Client\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????目錄???????????0??2016-06-05?20:39??Client\obj\Debug\TempPE\
?????文件????????1117??2016-06-24?21:59??Client\Program.cs
?????目錄???????????0??2016-06-05?20:39??Client\Properties\
?????文件????????1320??2016-06-05?20:39??Client\Properties\AssemblyInfo.cs
?????文件?????2724746??2016-06-24?22:01??Client\sample.docx
?????目錄???????????0??2016-06-05?22:28??Server\
?????文件????????1592??2016-06-05?22:28??Server\App.config
?????目錄???????????0??2016-06-05?20:49??Server\bin\
?????目錄???????????0??2016-06-24?22:05??Server\bin\Debug\
?????文件????????5120??2016-06-24?22:01??Server\bin\Debug\Server.exe
............此處省略60個文件信息
- 上一篇:微信公眾號支付接口
- 下一篇:asp.net 銀聯支付
評論
共有 條評論