2011-12-01 83 views
0

我正在從事涉及調用WCF Web服務以將給定文件的內容上傳到WCF Web服務的項目。客戶端是使用Titanium Studio編寫的iPad應用程序。但我可以發送小於8KB的文件。但我發送的文件可能大於8KB。當我發送大於8KB的文件時,Web服務返回以下錯誤消息。將文本文件的內容發送到WCF Web服務

服務器遇到錯誤處理請求

下面給出是客戶端代碼調用

數據使用JSON格式發送到web服務。

 var readFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'log.txt'); 

     modifiedDate = readFile.modificationTimestamp(); 
     var payload ={dateTime: modifiedDate, fileName:'log.txt' , text:readFile}; 


    var xhrLog = Titanium.Network.createHTTPClient(); 
    var serviceUrl = 'http://192.168.134.134/webservice/viewerservice.svc/submitLogData/'; 

    xhrLog.open("POST", serviceUrl); 
    xhrLog.setRequestHeader("Content-Type", ""); 
    xhrLog.setRequestHeader("Authentication-Token", "605b32dd");  
    xhrLog.onload = function() { 
     Ti.API.info(this.responseText); 
    }, 
    xhrLog.onerror = function() { 

    } 
    xhrLog.send(JSON.stringify(sendData)); 

以下是WCF Web服務中用於檢索數據的服務契約和數據契約。

[OperationContract] 
     [WebInvoke(
      RequestFormat = WebMessageFormat.Json, 
      ResponseFormat = WebMessageFormat.Json, 
      BodyStyle = WebMessageBodyStyle.Bare, 
      UriTemplate = "/SubmitLogData/")] 
     bool SubmitLogData(List<LogData> log); 

數據合同

​​

回答

0

你可能需要增加所有配額 - example of messagesize - 將是有益的,如果你能啓用WCF服務器端跟蹤並查看確切的錯誤信息!

更新:例如用於的wsHttpBinding:

<binding name="wsHttp" maxReceivedMessageSize="2147483647"> 
    <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
    maxArrayLength="2147483647" maxBytesPerRead="2147483647" 
    maxNameTableCharCount="2147483647" > 
</binding> 
相關問題