2012-09-25 3 views
0

WCF 서비스에서 메서드를 호출하고 파일 내용이 들어있는 byte [] 유형의 속성을 가진 DTO를 전달합니다. 파일이 약 3MB에이를 때까지 제대로 작동합니다.이 시점에서 실패합니다. 찾을 수 있었던 모든 정보는 구성 속성을 더 큰 값으로 설정하는 것에 대해 이야기했지만 이미 모든 것을 극대화했습니다. 이것은 내 웹 인트 config 파일에서입니다 :WCF 서비스에 대용량 (ish) 바이트 배열을 전달할 때 모든 Max Attributes가 최대 값으로 설정되지 않음

<bindings> 
    <wsHttpBinding> 
    <binding name="dxWsBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647"> 
     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
     <security mode="None" > 
     <transport clientCredentialType="None" /> 
     <message establishSecurityContext="false" /> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 

<behaviors> 
    <endpointBehaviors> 
    <behavior name="UserContextClientBehavior"> 
     <dataContractSerializer maxItemsInObjectGraph="2147483647"/> 
     <UserContextBehaviorExtension /> 
    </behavior> 
    </endpointBehaviors> 
</behaviors> 

이 내 웹 서비스 설정 파일에서이다 : 생산에 그 최대 값을 사용하는 내 의도가 아니라 내가 것을

<behaviors> 
    <serviceBehaviors> 
    <behavior name="DefaultBehavior"> 
     <serviceMetadata httpGetEnabled="True"/> 
     <serviceDebug includeExceptionDetailInFaults="True"/> 
    </behavior> 
    <behavior name="ErrorLoggerBehavior"> 
     <serviceMetadata httpGetEnabled="True"/> 
     <serviceDebug includeExceptionDetailInFaults="True"/> 
     <dataContractSerializer maxItemsInObjectGraph="2147483647"/> 
     <ErrorLogger logName="DXWcfErrorLog" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

<bindings> 
    <wsHttpBinding> 
    <binding name="dxWsBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647"> 
     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
     <security mode="None" > 
     <transport clientCredentialType="None" /> 
     <message establishSecurityContext="false" /> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 

주 이 일을하기 위해 모든 것을 시도하십시오.

요청이 실패하면 내 웹 서비스에 아무것도 표시되지 않습니다. 둘 다 설정 파일에이 시도 :

<system.diagnostics> 
    <trace autoflush="true"> 
    <listeners> 
    </listeners> 
    </trace> 
    <sources> 
    <source name="System.ServiceModel" 
      switchValue="Information, ActivityTracing" 
      propagateActivity="true"> 
     <listeners> 
     <add name="sdt" 
      type="System.Diagnostics.XmlWriterTraceListener" 
      initializeData= "WcfDetailTrace.svclog" /> 
     </listeners> 
    </source> 
    </sources> 
</system.diagnostics> 

을하지만 웹 서비스 로그 파일을 열 때 전혀 실패한 요청의 흔적이 없었다. 웹 사이트 로그 파일은 내가 이미 알고있는 것을 보여주었습니다. 클라이언트 측에서 얻은 정보, 즉 웹 사이트는 다음과 같습니다.

2012-09-25 12:26:46,273 ERROR Unexpected exception occurred 
System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to http://localhost:52114/DocumentService.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host 
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) 
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) 
--- End of inner exception stack trace --- 
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) 
at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) 
at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) 
--- End of inner exception stack trace --- 
at System.Net.HttpWebRequest.GetResponse() 
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) 
--- End of inner exception stack trace --- 

Server stack trace: 
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason) 
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) 
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) 
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) 
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) 
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 

Exception rethrown at [0]: 
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 
at SI.Doh.Aon.Service.Interface.IServiceBase`1.AddEntity(TDto dto) 
at SI.Doh.Aon.Web.Controllers.DocumentUploaderController.Upload(DocumentEditModel model, HttpPostedFileBase FileName) in C:\SVN Source\Department_Of_Health\Area_Of_Need\src\SI.Doh.Aon.Web\Controllers\DocumentUploaderController.cs:line 142 
at lambda_method(Closure , ControllerBase , Object[]) 
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) 
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) 
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) 
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters> 
    b__12() 
    at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) 
    at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<>c__DisplayClass17.<InvokeActionMethodWithFilters> 
    b__14() 
    at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) 
    at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) 
    at System.Web.Mvc.Controller.ExecuteCore() 
    at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) 
    at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) 
    at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest> 
     b__5() 
     at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate> 
     b__0() 
     at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous> 
      b__7(IAsyncResult _) 
      at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() 
      at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest> 
      b__d() 
      at System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) 
    at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) 
    at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) 
    at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) 
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 

답변

4

또한 httpRuntime 속성 내에 maxRequestLength가 있습니다.

<system.web> 
    <httpRuntime maxRequestLength="2097151" /> 
</system.web> 
+1

실제로 내가 놓친 최대 값이었습니다. 비슷한 주제에서 본 다른 여러 질문에서 언급 한 특정 속성을 본 것을 기억하지 않으므로 Cybermaxs에게 감사드립니다. – jmcilhinney

관련 문제