2013-04-17 3 views
1

У меня возникла проблема с отправкой большого файла через webService (System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse).Ошибка запроса webService с HTTP-статусом 404

Все работает нормально, когда файл меньше 20 МБ, если он больше, я получаю ответ с кодом 404.

Exception Информация

Exception Type: System.Net.WebException 
Status: ProtocolError 
Response: System.Net.HttpWebResponse 
Message: The request failed with HTTP status 404: Not Found. 
Data: System.Collections.ListDictionaryInternal 
TargetSite: System.Object[] ReadResponse(System.Web.Services.Protocols.SoapClientMessage, System.Net.WebResponse, System.IO.Stream, Boolean) 
HelpLink: NULL 
Source: System.Web.Services 

StackTrace Информация

at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) 
    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) 
    at ie.osds.DocumentsTransferBLL.FSDMZRepositoryService.FileStreamingWebService.UploadScanning(DateTime DateCreated, String Title, String FileName, String ReferenceNumber, String Author, String DocumentType, XmlNode IndexData, Byte[] Content, Nullable`1 IsCompressed, Nullable`1 Version, DateTime DateReceived, String CreatedBy, String OrigDocumentGUID) 
    at ie.osds.DocumentsTransferBLL.Actions.ActionsHelper.UploadDocumentToDMZFileStreaming(FileStreamingWebService fsDMZWebService, SPQDocument spqDocument, String documentReferenceNumber, String documentAuthor, String documentType, Byte[] documentContent, String version, DateTime dateReceived) 
    at ie.osds.DocumentsTransferBLL.Actions.DocumentsUploadAction.Upload()* 
+0

Можете ли вы опубликовать некоторые неисправные коды? – Watt

+0

a момент я не могу, потому что я только регистрирую сообщение об ошибке и пытаюсь его решить. Это нужно с помощью простой веб-службы потоковой передачи файлов и использования метода обновления. –

ответ

0

Похоже вашей загрузки файла истекает время:

Вы можете поймать эту ошибку в вашем global.asax чтобы убедиться, что это так:

Protected Sub Application_EndRequest(ByVal sender As Object, ByVal e As System.EventArgs) 

    Dim context As HttpContext = HttpContext.Current.ApplicationInstance.Context 
    If Not IsNothing(context) Then 

     If Not context.Response.StatusCode = HttpStatusCode.OK Then 

      'Detect file upload exceeded max length: 
      If context.Response.StatusCode = 404 And 
       context.Response.SubStatusCode = 13 Then 
       'clear the previous error page content: 
       context.Response.Clear() 
       'redirect to custom error page: 
       context.Server.Transfer("~/error.aspx?code=404.13", False) 
      End If 

     End If 

    End If 
End Sub 

Вы также можете увеличить длину запроса в вашем web.config так:

<system.web> 
    <httpRuntime maxRequestLength="29296" /> 
</system.web> 

Примечание: Значение в килобайтах

0

Если есть ссылка вебсервис в сети приложение просто удалит, а затем перестроит, запустит веб-сервис, а затем снова добавит ссылку на веб-службу в веб-приложение.

Смежные вопросы