1
服務器端從客戶端獲取zip數據包。解壓該包並解析xml數據到sql server,然後返回成功消息到客戶端!WCF REST上傳文件
但我遇到問題。當客戶端上傳成功後,我不得不及時將成功消息返回給客戶端,而不是在將數據插入數據庫之後!
你能提前幫我嗎?對不起,我的英語不好!
public IAsyncResult BeginAsyncUpload(string token, Stream data, string fileName, string Org, AsyncCallback callback, object asyncState)
{
if (BaseClass.HasPermission(token))
{
return new CompletedAsyncResult<Stream>(data, fileName,Org);
}
else
{
return null;
}
}
public string EndAsyncUpload(IAsyncResult ar)
{
Stream data = ((CompletedAsyncResult<Stream>)ar).Data;
string fileName = ((CompletedAsyncResult<Stream>)ar).FileName;
string Organization = ((CompletedAsyncResult<Stream>)ar).Org;
try
{
return _streamToFile(data, fileName, Organization);
}
catch
{
return "SUCCESS!";
}
}
的_streamToFile方法插入數據到數據庫