以下是 Web Service 方法的外观:
[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 中使用它?任何帮助深表感谢。提前致谢。
//深浅