14
以下是我用我的測試應用程序的代碼:WCF REST Webinvoke沒有找到
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.IO;
namespace MyWCFServices
{
[ServiceContract]
interface IHelloWorldService
{
[OperationContract]
String GetMessage(String name);
//[OperationContract]
//[WebInvoke(Method = "PUT",UriTemplate = "File/{fileName}")]
//[WebContentType("application/octet-stream")]
// bool UploadFile(string fileName, Stream fileContents);
[OperationContract]
[WebInvoke(UriTemplate = "UploadFile/{fileName}")]
void UploadFile(string fileName, Stream fileContent);
}
}
它給錯在編譯的webinvoke。任何想法都一樣?
WebContentType怎麼樣? – Ankit 2011-04-25 12:41:55
您使用的是什麼版本的.NET/WCF? – 2011-04-25 12:42:57
我正在使用.NET 4.0(不是4.0客戶端配置文件) – Ankit 2011-04-25 12:57:35