WCF 서비스에서 Silverlight 클라이언트로 강력하게 형식화 된 FaultExceptions를 전달하려고 시도하지만 일반적으로 "원격 서버가 오류를 반환했습니다 : NotFound"입니다. 응답, 일반 FaultExceptions 던져 동일한 코드를 사용하여 잘 작동합니다.강력하게 형식화 된 FaultExceptions이 작동하지 않습니다.
따라서 Throw New FaultException()
을 수행하면 Silverlight 콜백의 e.Error
매개 변수가 반환되고 Throw New FaultException(Of clsServiceFault)(clsServiceFaultInstance)
오류는 찾을 수 없습니다.
clsServiceFault
아직 같은 데이터 계약으로 선언 된
<DataContract()> _
Public Enum ServiceFaultTypes
LoginFailed
SessionExpired
End Enum
<DataContract()> _
Public Class clsServiceFault
Public Sub New()
End Sub
Public Sub New(iType As ServiceFaultTypes, iMessage As String)
Type = iType
Message = iMessage
End Sub
<DataMember()> _
Public Property Type As ServiceFaultTypes
<DataMember()> _
Public Property Message As String
End Class
오류가 FaultContract
속성으로 장식되어 발생합니다 나는 또한 HTTP 응답 상태 코드를 변경있어하는 WCF 방법
<OperationContract()> _
<FaultContract(GetType(clsServiceFault))> _
Public Function GetCustomersData(...)
...
System.ServiceModel.Web.WebOperationContext.Current.OutgoingResponse.StatusCode = Net.HttpStatusCode.OK
Throw New FaultException() 'Works
Throw New FaultException(Of clsServiceFault)(new clsServiceFault(..)) 'Does not work
...
End Function
무엇이 여기에 있습니까?
REST 서비스를 사용 중입니다. 그것들도'FaultException'을 사용합니까? –