2011-07-14 52 views
1

我有我使用JSON的WCF服務。 現在我需要接收純文本消息(頭文+文本) 所以,我期望在fileContents中獲取字符串,但服務失敗,因爲它不是JSON編碼的。WCF - 如何接收純字符串?

我如何編碼我的方法,以允許這樣做?

這是我的方法

[WebInvoke(Method = "POST", UriTemplate = "/files/{fileName}")] 
     public void UploadFile(string fileName, string fileContents) 
     { 

     } 

這是我的服務:

[ServiceContract] 
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] 
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] 
    public class MobileService 
    { 

回答