2013-10-10 53 views
0

這裏的服務方法如何對Web的樣子:使用jQuery如何消費基於REST WCF Web服務來上傳文件

[ServiceContract] 
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] 
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] 
public class FileUploadService 
{ 
    [WebInvoke(UriTemplate = "UploadFile/{folder}/{fileName}", Method = "POST")] 
    public void UploadFile(string folder, string fileName, Stream fileContents) 
    { 
     // Code removed for brevity. Basically we are reading the fileContents into FileStream and saving it on server. 

    } 
} 

我可以寫一個小的.NET應用程序和使用該Web服務。我的問題是我如何從jQuery中使用它?任何幫助深表感謝。提前致謝。

// Sandeep

回答