문제

나는 손자의 컬렉션을 다시 잡을 수있는 childobjects 모음을 보유하는 물체를 반환하려는 문제가 발생합니다. '호스트가 강제로 닫는 연결'인 오류가 발생합니다.

이 일을 할 수있는 방법이 있습니까? 나는 현재 이것과 유사한 구조가 있습니다.

의사 코드 :

Person:
IEnumerable<Order>

Order:
IEnumerable<OrderLine>

세 개체 모두 데이터 콘텐츠 속성이 있으며, 내가 노출하려는 모든 공개 속성 (ienumerable 포함)에는 Datamember 속성이 있습니다.

내 서비스에 여러 개의 OperationContract가 있으며 단일 객체를 반환하거나 객체의 객체가 완벽하게 작동하는 모든 방법이 있습니다. 내가 나쁘게 변하는 것은 내가 ienumerable을 둥지로 만들 때만 가능합니다. 또한 내 클라이언트 서비스 참조에서 일반 목록을 수집 유형으로 선택했습니다. 나는 단지 강조하고 싶다. 이 오류로 내 작업/방법 중 하나만 실패합니다. 나머지는 완벽하게 작동합니다..

편집 (보다 자세한 오류 설명) :

[SocketException (0x2746): An existing connection was forcibly closed by
the remote host]
[IOException: Unable to read data from the transport connection:
An existing connection was forcibly closed by the remote host.]
[WebException: The underlying connection was closed: An unexpected
error occurred on a receive.]
[CommunicationException: An error occurred while receiving the HTTP
response to http://myservice.mydomain.dk/MyService.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.]

통나무를 찾으려고 노력했지만 아무것도 찾을 수 없습니다 ... 또한 WSHTTPBinding과 HTTP 엔드 포인트를 사용하고 있습니다.

도움이 되었습니까?

해결책

참고로, WCF 로깅 유틸리티 사용 방법을 배워야합니다.

로깅 정보.

구성 편집기 (설정으로 스냅 립이됩니다).

추적 시청자. 엄청나 다. 여러 서비스 (클라이언트 및 서버)가 추적하여이를 가입하여 모든 세부 정보를 분석 할 수 있습니다. 문제의 근원을 정말 빠르게 얻을 수 있습니다. (서버 WCF 오류가 있으면 클라이언트가 유용한 데이터를 얻지 못할 것입니다.)

다른 팁

좋아, 마침내 내 경우에는 실제 문제를 발견했습니다. 노출 된 열거가 세계에서 가장 큰 것이 아닌 것 같습니다. 나는 그들에게 기본값을 설정하거나 대신에 재산을 INT 또는 내 열거 한 정수 유형으로 노출시켜야합니다.

도와 주셔서 감사합니다. 당신은 이것을 알 수있는 방법이 없었습니다 - 나는 내 구조의 3 단계에서 열거를 발견하고 데이터 멘터를 하나씩 체계적으로 제거하는 것이 내가 발견 한 방식이라는 것을 체계적으로 제거했습니다. 이 문제를 해결 한 사람은 내가 유일한 사람이 아닌 것 같습니다.이 사람은 분명히 비슷한 문제가있었습니다 :)

http://zianet.dk/blog/2007/11/24/serializing-enums-in-wcf/

WCF+(EF+POCO)로 작업하는 경우 설정을 시도하십시오.

ObjectContext.ContextOptions.LazyLoadingEnabled = false;
ObjectContext.ContextOptions.ProxyCreationEnabled = false;

이 줄을 추가하십시오 <system.web/>:

<httpRuntime maxRequestLength="102400" executionTimeout="3600" />

열거는 a DataContract 어떤 클래스와 마찬가지로 속성이지만 열거 값은 DataMember 그들에 대한 속성.

변경하십시오 EnumMember 그리고이 불가능한 오류가 발생하지 않을 것입니다.

이것은 실제로 첫 번째 예외 설명과 동일한 정보입니다. 그것은 pocketexception의 원래 원인이 무엇인지 상호 작용할 것입니다. 서비스 자체에서 일부 유형의 오류 여야합니다. 정확히 부두 예외가 발생하는 위치를 찾을 수 있습니까?

nhibernate에 의해 덮어 쓰고 (가상으로 표시됨) 정상적인 ienumerables를 반환하려고 할 때 비슷한 오류가 있었고, 직렬화 할 수없는 일반화 가방으로 대체되었습니다. nhibernate 또는 비슷한 무언가로 인해 ienumerable datamembers를 가상으로 표시 했습니까? 이것은 당신의 오류를 설명 할 수 있습니다.

BTW. WCF 예외는 종종 매우 의미가 없습니다 (버그를 추적 할 때 매우 실망 스러울 수 있습니다.)

나도 같은 문제를 겪었습니다 (.NET 3.5). 내 기본 클래스가 나옵니다 DataContract 알려진 유형이 누락되었습니다. 불행히도 WCF 오류가 더 설명 적이 지 않았다는 것은 불행한 일입니다.

서비스 동작 구성에서 지정 했습니까? 이 스택 트레이스에는 일부 정보가 누락 된 것 같습니다.

서버 측에서 예외를 가져올 수 있습니까 (예 : Visual Studio Debug Mode 또는 Log4Net과 같은 로깅 라이브러리).

서비스 구성 자체가 작동하는지 확인하기 위해 동일한 서비스에서 다른 방법 (Simple HelloWorld () 예를 들어)를 호출해 보셨습니까? 이런 종류의 제외는 또한 일부 직렬화 문제를 나타낼 수 있습니다. 와이어로 어떤 유형을 보내고 싶습니까? 알려진 유형의 어딘가에 사용하십니까?

Server Error in '/' Application.
--------------------------------------------------------------------------------

An existing connection was forcibly closed by the remote host 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[SocketException (0x2746): An existing connection was forcibly closed by the remote host]
   System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) +93
   System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +119

[IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.]
   System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +267
   System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) +25
   System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) +306

[WebException: The underlying connection was closed: An unexpected error occurred on a receive.]
   System.Net.HttpWebRequest.GetResponse() +1532114
   System.ServiceModel.Channels.HttpChannelRequest.WaitForReply(TimeSpan timeout) +40

[CommunicationException: An error occurred while receiving the HTTP response to http://Zzzstrukturservice.xxx.dk/ZzzstrukturService.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.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +2668969
   System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +717
   xxx.Services.ZzzstrukturServiceClient.ZzzstrukturServiceProxy.IZzzstrukturService.GetMatrixSet(Int32 matrixSetId) +0
   xxx.Services.ZzzstrukturServiceClient.ZzzstrukturRepository.GetMatrixSetById(Int32 matrixSetId) in f:\ccnet\work\xxx.Zzzstruktur\1. Presentation Layer\ZzzstrukturServiceClient\ZzzstrukturRepository.cs:90
   xxx.yyy.yyyWeb.AnnoncePage.OnLoad(EventArgs e) in f:\ccnet\work\yyyV2\1. Presentation Layer\yyyWeb\Annonce.aspx.cs:40
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433 

왜 이런 일이 일어날 수 있는지 모르겠습니다. 그러나 나는 또한 비슷한 문제가있었습니다.

나는 열거를 변경했다.

문자를 반환하지 마십시오 IEnumerable 계약에는 유명한 사람이 있습니다 wcf ienumerable 버그

설정해보십시오 [OperationBehavior()] 인터페이스 방법의 구현 이상.

'수율 리턴'을 사용하여 내에 매핑 된 개체의 열거를 구축 할 때이 오류가 발생했습니다. DataContract 유형.

부름 ToList / ToArray 수율 결과에서 문제가 해결되었고 서비스 호출은 올바르게 작동했습니다.

그렇습니다. 나는 여기에도 같은 문제가 있었고 그것은 열거적인 값이있는 반환 객체와 함께 할 일이었습니다. 변경 DataMember int와 모든 것이 통계적으로 작동합니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top