We got a weird error and can't make heads or tails of it, as it is one of a gazillion of serialized calls we do every day without issues for years. Here is the google translation into English of that error message, so the real English message may be worded differently:
System.ServiceModel.Dispatcher.NetDispatcherFaultException: An error
occurred while trying to deserialize the message parameter
http://tempuri.org/: ExecuteResult. InnerException message 'Internal
error occurred. Cache overflow in DataContract. ' was. See
InnerException for details. An exception was thrown from the formatter
when attempting to deserialize - ->
System.Runtime.Serialization.SerializationException: An internal error
occurred. Cache overflow in DataContract.
And this is the full stack trace, including the original Japanese message:
System.ServiceModel.Dispatcher.NetDispatcherFaultException: メッセージ パラメーター http://tempuri.org/:ExecuteResult をシリアル化解除しようとしているときにエラーが発生しました。InnerException メッセージは '内部エラーが発生しました。DataContract のキャッシュ オーバーフローです。' でした。詳細については InnerException を参照してください。 のシリアル化を解除しようとしているときに、フォーマッタから例外がスローされました ---> System.Runtime.Serialization.SerializationException: 内部エラーが発生しました。DataContract のキャッシュ オーバーフローです。
場所 System.Runtime.Serialization.DataContract.DataContractCriticalHelper.GetIdForInitialization(ClassDataContract classContract)
場所 System.Runtime.Serialization.XmlFormatReaderGenerator.CriticalHelper.CreateObject(ClassDataContract classContract)
場所 System.Runtime.Serialization.XmlFormatReaderGenerator.CriticalHelper.GenerateClassReader(ClassDataContract classContract)
場所 System.Runtime.Serialization.XmlFormatReaderGenerator.GenerateClassReader(ClassDataContract classContract)
場所 System.Runtime.Serialization.ClassDataContract.get_XmlFormatReaderDelegate()
場所 System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
場所 System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
場所 ReadPFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
場所 System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
場所 System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
場所 ReadAOPFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
場所 System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
場所 System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
場所 ReadAOPFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
場所 System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
場所 System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
場所 ReadOFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
場所 System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
場所 System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
場所 ReadODFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
場所 System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
場所 System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
場所 ReadORFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
場所 System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
場所 System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
場所 System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, String name, String ns)
場所 System.Runtime.Serialization.NetDataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
場所 System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
場所 System.Runtime.Serialization.NetDataContractSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName)
場所 System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.PartInfo.ReadObject(XmlDictionaryReader reader, XmlObjectSerializer serializer)
場所 System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)
--- 内部例外スタック トレースの終わり ---
Server stack trace:
場所 System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)
場所 System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
場所 System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
場所 System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
場所 System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
場所 System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
場所 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
場所 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
場所 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
場所 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
場所 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
...
What causes it, and how can it be prevented?
N.B. Looking at the source code, such an error is thrown in here.
Related
I have an exception I'm struggling to resolve here.
A legacy project of ours uses Windows Workflow Foundation. The XAML workflows are all defined in an assembly called Project16.Workflow. The default namespace for this assembly is however Project16.Servcies.Workflow.
The exception we are seeing:
System.Runtime.DurableInstancing.InstancePersistenceCommandException: The execution of the InstancePersistenceCommand named {urn:schemas-microsoft-com:System.Activities.Persistence/command}LoadWorkflow was interrupted by an error. ---> System.Runtime.Serialization.SerializationException: The deserializer cannot load the type to deserialize because type 'System.Activities.Variable`1+VariableLocation[[Project16.Services.Workflow.OutcomeReportPublishOptions, Project16.Services.Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' could not be found in assembly 'System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Check that the type being serialized has the same contract as the type being deserialized and the same assembly is used.
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadArrayOfLocationFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadLocationEnvironmentFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadActivityInstanceFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadActivityInstance.ChildListFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadActivityInstanceFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadActivityInstanceMap.InstanceListFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadArrayOfActivityInstanceMap.InstanceListFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadInstanceMapFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadExecutorFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadKeyValuePairOfXNameanyTypenNMwwVNaFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, String name, String ns)
at System.Runtime.Serialization.NetDataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
at System.Runtime.Serialization.XmlObjectSerializer.InternalReadObject(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObject(XmlDictionaryReader reader)
at System.Activities.DurableInstancing.DefaultObjectSerializer.DeserializePropertyBag(Stream stream)
at System.Activities.DurableInstancing.GZipObjectSerializer.DeserializePropertyBag(Stream stream)
at System.Activities.DurableInstancing.DefaultObjectSerializer.DeserializePropertyBag(Byte[] serializedValue)
at System.Activities.DurableInstancing.SerializationUtilities.DeserializePropertyBag(Byte[] primitiveDataProperties, Byte[] complexDataProperties, InstanceEncodingOption encodingOption)
at System.Activities.DurableInstancing.LoadWorkflowAsyncResult.ProcessSqlResult(SqlDataReader reader)
at System.Activities.DurableInstancing.SqlWorkflowInstanceStoreAsyncResult.SqlCommandAsyncResultCallback(IAsyncResult result)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.Runtime.DurableInstancing.InstancePersistenceContext.OuterExecute(InstanceHandle initialInstanceHandle, InstancePersistenceCommand command, Transaction transaction, TimeSpan timeout)
at System.Runtime.DurableInstancing.InstanceStore.Execute(InstanceHandle handle, InstancePersistenceCommand command, TimeSpan timeout)
at System.Activities.WorkflowApplication.PersistenceManager.Load(TimeSpan timeout)
at System.Activities.WorkflowApplication.LoadValues(PersistenceManager persistenceManager, TimeoutHelper timeoutHelper, Boolean loadAny)
at System.Activities.WorkflowApplication.LoadCore(TimeSpan timeout, Boolean loadAny, PersistenceManager persistenceManager)
at System.Activities.WorkflowApplication.GetInstance(Guid instanceId, InstanceStore instanceStore, TimeSpan timeout)
at System.Activities.WorkflowApplication.GetInstance(Guid instanceId, InstanceStore instanceStore)
at Project16.Services.Workflow.WorkflowService.GetWorkflowInstance(Guid instanceId) in D:\a\1\s\Project16Development\Project16.Workflow\WorkflowService.cs:line 219
at Project16.Services.Workflow.WorkflowService.<UpdateWorkflows>d__18.MoveNext() in D:\a\1\s\Project16Development\Project16.Workflow\WorkflowService.cs:line 170
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Project16.WebApi.Core.Controllers.WorkflowController.<Process>d__2.MoveNext() in D:\a\1\s\Project16Development\Project16.WebApi.Core\Controllers\WorkflowController.cs:line 22
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__17`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__17`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Tracing.Tracers.HttpControllerTracer.<ExecuteAsyncCore>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__17`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()
I believe the crux of the problem is:
The deserializer cannot load the type to deserialize because type 'System.Activities.Variable`1+VariableLocation[[Project16.Services.Workflow.OutcomeReportPublishOptions, Project16.Services.Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' could not be found in assembly 'System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
I don't think the problem is with a missing System.Activities that's referenced fine.
Now, what I don't get is OutcomeReportPublishOptions is a class defined in Project16.Workflow under the Project16.Services.Workflow namespace, yet looking at that it looks like it's trying to load it from an assembly called Project16.Services.Workflow.
In the XAML it's referenced like this:
<Variable x:TypeArguments="local1:OutcomeReportPublishOptions" Name="publishOptions" />
So I looked at the namespace and originally it was:
xmlns:local1="clr-namespace:Project16.Services.Workflow"
So I tried:
xmlns:local1="clr-namespace:Project16.Services.Workflow;assembly=Project16.Workflow"
However the problem still persists.
What am I missing?
Turns out the issue is because we renamed the assembly!
We moved from Project16.Services.Workflow to Project16.Workflow during a refactor and weren't aware of the binary serialisation employed by WWF into the instance storage.
I managed to hack a fix by creating a new assembly under the old name and putting a type forward in.
Can someone help me with this error ? this throws on 4 of 5 developer boxes and does not (fortunatelly) on production enviroment, yet no idea why.
System.Web.Services.Protocols.SoapException: Server was unable to
process request. ---> System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. --->
System.OverflowException: Value was either too large or too small for
a Decimal. at System.Number.ParseDecimal(String value, NumberStyles
options, NumberFormatInfo numfmt) at System.Convert.ToDecimal(String
value, IFormatProvider provider) at
System.String.System.IConvertible.ToDecimal(IFormatProvider provider)
at System.Convert.ToDecimal(Object value) at
MySql.Data.MySqlClient.MySqlDataReader.GetDecimal(Int32 i) at
MySql.Data.Entity.EFMySqlDataReader.GetDecimal(Int32 ordinal) ---
End of inner exception stack trace --- at
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[]
arguments, Signature sig, Boolean constructor) at
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj,
Object[] parameters, Object[] arguments) at
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at
System.Data.Entity.Core.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader1.GetTypedValueDefault(DbDataReader
reader, Int32 ordinal) at
System.Data.Entity.Core.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader1.GetValue(DbDataReader
reader, Int32 ordinal) at lambda_method(Closure , Shaper ) at
System.Data.Entity.Core.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func2
constructEntityDelegate, EntityKey entityKey, EntitySet entitySet)
at lambda_method(Closure , Shaper ) at
System.Data.Entity.Core.Common.Internal.Materialization.Coordinator1.ReadNextElement(Shaper
shaper) at
System.Data.Entity.Core.Common.Internal.Materialization.Shaper1.RowNestedResultEnumerator.MaterializeRow()
at
System.Data.Entity.Core.Common.Internal.Materialization.Shaper1.RowNestedResultEnumerator.MoveNext()
at
System.Data.Entity.Core.Common.Internal.Materialization.Shaper1.ObjectQueryNestedEnumerator.TryReadToNextElement()
at
System.Data.Entity.Core.Common.Internal.Materialization.Shaper1.ObjectQueryNestedEnumerator.ReadElement()
at
System.Data.Entity.Core.Common.Internal.Materialization.Shaper1.ObjectQueryNestedEnumerator.MoveNext()
at System.Data.Entity.Internal.LazyEnumerator1.MoveNext() at
System.Collections.Generic.List1..ctor(IEnumerable1 collection) at
System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at
Glocalapps.BusinessLogic.Logic.ProductLogic.GetProductManagementCatalogData(Int32
idCatalog, Int32 skip, Int32 take, String name, Nullable1 isActive,
Nullable1 isVisible, Nullable1 revised)
I've been at this for days now and I just do not understand why this error is occurring. It's a FileLoadException for log4net v1.2.10.0, but it occurs during a XRM SDK linq query. I use log4net v1.2.12.0 in the application, and I expected a bindingRedirect to fix this but it doesn't. (The v1.2.10.0 log4net is required by a library that I use)
It looks like the XRM sdk somehow tries to serialize/deserialize assemblies. I'm not sure why it does this, I reckon the post may be relevant.
Inner Exception is null
Exception Message:
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040)":"log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821
Server stack trace:
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
at System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit)
at Microsoft.Xrm.Sdk.KnownTypesProvider.GetProxyTypesAttribute(Assembly assembly)
at Microsoft.Xrm.Sdk.KnownTypesProvider.RegisterAssembly(Assembly assembly)
at Microsoft.Xrm.Sdk.KnownTypesProvider.get_KnownAssemblies()
at Microsoft.Xrm.Sdk.KnownTypesProvider.get_KnownOrganizationRequestResponseTypes()
at Microsoft.Xrm.Sdk.KnownTypesResolver.ResolveName(String typeName, String typeNamespace, Type declaredType, DataContractResolver knownTypeResolver)
at System.Runtime.Serialization.XmlObjectSerializerContext.ResolveDataContractFromDataContractResolver(XmlQualifiedName typeName, Type declaredType)
at System.Runtime.Serialization.XmlObjectSerializerContext.ResolveDataContractFromKnownTypes(String typeName, String typeNs, DataContract memberTypeContract, Type declaredType)
at System.Runtime.Serialization.XmlObjectSerializerContext.IsKnownType(DataContract dataContract, Type declaredType)
at System.Runtime.Serialization.XmlObjectSerializerContext.IsKnownType(DataContract dataContract, Dictionary`2 knownDataContracts, Type declaredType)
at System.Runtime.Serialization.KnownTypeDataContractResolver.TryResolveType(Type type, Type declaredType, DataContractResolver knownTypeResolver, XmlDictionaryString& typeName, XmlDictionaryString& typeNamespace)
at Microsoft.Xrm.Sdk.KnownTypesResolver.TryResolveType(Type type, Type declaredType, DataContractResolver knownTypeResolver, XmlDictionaryString& typeName, XmlDictionaryString& typeNamespace)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.ResolveType(Type objectType, Type declaredType, XmlDictionaryString& typeName, XmlDictionaryString& typeNamespace)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteResolvedTypeInfo(XmlWriterDelegator writer, Type objectType, Type declaredType)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteTypeInfo(XmlWriterDelegator writer, DataContract contract, DataContract declaredContract)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiTypeAtTopLevel(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle originalDeclaredTypeHandle, Type graphType)
at System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.XmlObjectSerializer.WriteObject(XmlDictionaryWriter writer, Object graph)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameterPart(XmlDictionaryWriter writer, PartInfo part, Object graph)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameter(XmlDictionaryWriter writer, PartInfo part, Object graph)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameters(XmlDictionaryWriter writer, PartInfo[] parts, Object[] parameters)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter writer, MessageVersion version, String action, MessageDescription messageDescription, Object returnValue, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.SerializeBodyContents(XmlDictionaryWriter writer, MessageVersion version, Object[] parameters, Object returnValue, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.OperationFormatterMessage.OperationFormatterBodyWriter.OnWriteBodyContents(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.BodyWriterMessage.OnWriteBodyContents(XmlDictionaryWriter writer)
at System.ServiceModel.Security.SecurityAppliedMessage.OnWriteBodyContents(XmlDictionaryWriter writer)
at System.ServiceModel.Security.SecurityAppliedMessage.OnWriteMessage(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.BufferedMessageWriter.WriteMessage(Message message, BufferManager bufferManager, Int32 initialOffset, Int32 maxSizeQuota)
at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessage(Message message, Int32 maxMessageSize, BufferManager bufferManager, Int32 messageOffset)
at System.ServiceModel.Channels.HttpOutput.SerializeBufferedMessage(Message message)
at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.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 Microsoft.Xrm.Sdk.IOrganizationService.Execute(OrganizationRequest request)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.Execute(OrganizationRequest request)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest request)
at Microsoft.Xrm.Sdk.Linq.QueryProvider.RetrieveEntityCollection(OrganizationRequest request, NavigationSource source)
at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups, String& pagingCookie, Boolean& moreRecords)
at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups)
at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](Expression expression)
at Microsoft.Xrm.Sdk.Linq.QueryProvider.GetEnumerator[TElement](Expression expression)
at Microsoft.Xrm.Sdk.Linq.Query`1.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at ClassLibrary.Class1.Method1() in C:\Users\Greg.tarr\Documents\Visual Studio 2010\Projects\RestService\ClassLibrary\Class1.cs:line 36
This is possibly caused by an incorrect / outdated reference to log4net in the project (when using an updated version), references are compiled into the assembly and a load is then attempted. Taken from here
Also make sure your PublicKeyToken is correct.
If you've updated through NuGet the token can be incorrect / not update ... as per this SO post
We are currently experiencing the following error (from the logs) when using our Windows Azure App:
System.Runtime.Serialization.SerializationException Assembly 'EntityFrameworkDynamicProxies-Marriott.emergePortal.Common,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not found.
This error comes and goes we haven't been able to understand exactly what causes it.
We've tried everything! Any help that anyone could provide would be awesome.
The entire error message from the log is:
System.Web.HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown. ---> System.Runtime.Serialization.SerializatioFnException: Assembly 'EntityFrameworkDynamicProxies-Marriott.emergePortal.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not found.
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at ReadArrayOfPropertyEnrollmentFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at ReadArrayOfPropertyEnrollmentFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at ReadArrayOfanyTypeFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at ReadSerializableSessionStateStoreDataFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, String name, String ns)
at System.Runtime.Serialization.NetDataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObject(XmlDictionaryReader reader)
at Microsoft.ApplicationServer.Caching.NetDataContractCacheObjectSerializer.Deserialize(Stream stream)
at Microsoft.ApplicationServer.Caching.DataCacheObjectSerializationProvider.DeserializeUserObject(Byte[][] serializedData, ValueFlagsVersion flagsType)
at Microsoft.ApplicationServer.Caching.SocketClientProtocol.GetAndLock(String key, TimeSpan timeout, DataCacheLockHandle& lockHandle, String region, Boolean lockKey, IMonitoringListener listener)
at Microsoft.ApplicationServer.Caching.DataCache.<>c__DisplayClass8a.<GetAndLock>b__89()
at Microsoft.ApplicationServer.Caching.DataCache.GetAndLock(String key, TimeSpan timeout, DataCacheLockHandle& lockHandle)
at Microsoft.Web.DistributedCache.DataCacheForwarderBase.<>c__DisplayClass31`1.<PerformCacheOperation>b__30()
at Microsoft.Web.DistributedCache.DataCacheRetryWrapper.PerformCacheOperation(Action action)
at Microsoft.Web.DistributedCache.DataCacheForwarderBase.GetAndLock(String key, TimeSpan timeout, DataCacheLockHandle& lockHandle)
at Microsoft.Web.DistributedCache.BlobBasedSessionStoreProvider.GetItem(HttpContextBase context, String id, Boolean acquireWriteLock, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions)
at Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions)
at System.Web.SessionState.SessionStateModule.GetSessionStateItem()
at System.Web.SessionState.SessionStateModule.PollLockedSessionCallback(Object state)
at System.Web.SessionState.SessionStateModule.EndAcquireState(IAsyncResult ar)
at System.Web.HttpApplication.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar)
Without seeing any of the code, it's difficult to troubleshoot. However, we had something similar that was caused because the DataContractSerializer expected a specific type (as defined in the service interface), but was instead getting an EntityFramework proxy type.
We decided to use the Data Transfer Object pattern to resolve this. We created base classes that were simple data transfer objects. EF-aware classes inherit from these and add persistence-related logic.
These DTO objects implement ICloneable (or something similar) which allows us to easily create data transfer copies of the Entity Framework proxy classes before sending objects to the serializer at the service level.
It may also be possible to resolve this by creating a custom serializer that has knowledge of Entity Framework proxy classes but that approach seemed more like a hack. The DTO pattern seemed simpler and was very effective.
I'm writing console WCF-client for one WCF-WebService. When calling the service I get an error in deserializing body of request:
Error in deserializing body of reply message for operation 'GetProfiles'
Agent Code:
string userLogin = "root", userPassword = "root";
string ipaddress = "192.168.137.164";
HttpTransportBindingElement httpTransportBindingElement = new HttpTransportBindingElement();
httpTransportBindingElement.AuthenticationScheme = AuthenticationSchemes.Digest;
httpTransportBindingElement.KeepAliveEnabled = false;
httpTransportBindingElement.MaxBufferSize = int.MaxValue;
httpTransportBindingElement.MaxBufferPoolSize = int.MaxValue;
httpTransportBindingElement.MaxReceivedMessageSize = int.MaxValue;
TextMessageEncodingBindingElement textMessageEncodingBindingElement = new TextMessageEncodingBindingElement();
textMessageEncodingBindingElement.MaxReadPoolSize = int.MaxValue;
textMessageEncodingBindingElement.MaxWritePoolSize = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxDepth = 64;
textMessageEncodingBindingElement.ReaderQuotas.MaxBytesPerRead = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxArrayLength = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxNameTableCharCount = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxStringContentLength = int.MaxValue;
CustomBinding binding = new CustomBinding(textMessageEncodingBindingElement, httpTransportBindingElement);
EndpointAddress MediaEndPointAddress = new EndpointAddress("http://" + ipaddress + ":80/onvif/services");
MediaClient mediaClient = new MediaClient(binding, MediaEndPointAddress);
mediaClient.ClientCredentials.UserName.UserName = userLogin;
mediaClient.ClientCredentials.UserName.Password = userPassword;
Profile[] profiles = mediaClient.GetProfiles(); // throw excpetion
I have already watched the requests and responses with a sniffer and it's OK! The WebService has sent '200 OK'. If I have a small response from the WebService, there won't be any errors and exceptions! I haven't got WebService code. What should I do?
Stack trace:
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>131075</EventID>
<Type>3</Type>
<SubType Name="Error">0</SubType>
<Level>2</Level>
<TimeCreated SystemTime="2012-01-11T11:11:12.2185609Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{550193ea-8569-40e6-b794-1a0eed69a1ba}" />
<Execution ProcessName="TestingConsole.vshost" ProcessID="6128" ThreadID="9" />
<Channel />
<Computer>WS-LSH</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">
<TraceIdentifier>http://msdn.microsoft.com/ru-RU/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier>
<Description>Throwing an exception.</Description>
<AppDomain>TestingConsole.vshost.exe</AppDomain>
<Exception>
<ExceptionType>System.ServiceModel.CommunicationException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>Error in deserializing body of reply message for operation 'GetProfiles'. </Message>
<StackTrace>
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
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)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at TestingConsole.Onvif.Media.Media.GetProfiles(GetProfilesRequest request)
at TestingConsole.Onvif.Media.MediaClient.TestingConsole.Onvif.Media.Media.GetProfiles(GetProfilesRequest request)
at TestingConsole.Onvif.Media.MediaClient.GetProfiles()
at TestingConsole.Program.Main(String[] args)
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
</StackTrace>
<ExceptionString>System.ServiceModel.CommunicationException: Error in deserializing body of reply message for operation 'GetProfiles'. ---> System.InvalidOperationException: There is an error in XML document (2, 6287). ---> System.Xml.XmlException: The byte 0x03 is not valid at this location. Line 2, position 6287.
at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
at System.Xml.XmlUTF8TextReader.Read()
at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
at System.Xml.XmlDictionaryReader.ReadString()
at System.Xml.XmlBaseReader.ReadElementString()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
--- End of inner exception stack trace ---</ExceptionString>
<InnerException>
<ExceptionType>System.InvalidOperationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>There is an error in XML document (2, 6287).</Message>
<StackTrace>
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
</StackTrace>
<ExceptionString>System.InvalidOperationException: There is an error in XML document (2, 6287). ---> System.Xml.XmlException: The byte 0x03 is not valid at this location. Line 2, position 6287.
at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
at System.Xml.XmlUTF8TextReader.Read()
at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
at System.Xml.XmlDictionaryReader.ReadString()
at System.Xml.XmlBaseReader.ReadElementString()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)</ExceptionString>
<InnerException>
<ExceptionType>System.Xml.XmlException, System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>The byte 0x03 is not valid at this location. Line 2, position 6287.</Message>
<StackTrace>
at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
at System.Xml.XmlUTF8TextReader.Read()
at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
at System.Xml.XmlDictionaryReader.ReadString()
at System.Xml.XmlBaseReader.ReadElementString()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
</StackTrace>
<ExceptionString>System.Xml.XmlException: The byte 0x03 is not valid at this location. Line 2, position 6287.
at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
at System.Xml.XmlUTF8TextReader.Read()
at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
at System.Xml.XmlDictionaryReader.ReadString()
at System.Xml.XmlBaseReader.ReadElementString()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)</ExceptionString>
</InnerException>
</InnerException>
</Exception>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
I rewrite my code. Now I have got:
string soapRequest = "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\">" +
"<s:Header>" +
"</s:Header>" +
"<s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
"<GetProfiles xmlns=\"http://www.onvif.org/ver10/media/wsdl\"/>" +
"</s:Body>" +
"</s:Envelope>";
XmlReader envelopeReader = XmlReader.Create(new StringReader(soapRequest));
Message requestMsg = Message.CreateMessage(envelopeReader, int.MaxValue, MessageVersion.Soap12);
Message responseMsg = null;
IChannelFactory<IRequestChannel> channelFactory = binding.BuildChannelFactory<IRequestChannel>();
channelFactory.Open();
IRequestChannel channel = channelFactory.CreateChannel(MediaEndPointAddress);
channel.Open();
responseMsg = channel.Request(requestMsg);
Console.WriteLine(responseMsg.ToString());
The last string return message "Error reading body: System.Xml.XmlException: '�' contains invalid UTF8 bytes. ...}".
WebService sends non-ut8 bytes, but points "UTF-8" in header.
What can I do?
Reply Message Body
HTTP/1.1 200 OK
Server: gSOAP/2.7
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 11591
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:xmime5="http://www.w3.org/2005/05/xmlmime" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:ns1="http://www.onvif.org/ver20/analytics/wsdl" xmlns:ns2="http://www.onvif.org/ver10/schema" xmlns:ns3="http://docs.oasis-open.org/wsn/b-2" xmlns:ns4="http://docs.oasis-open.org/wsrf/bf-2" xmlns:ns5="http://docs.oasis-open.org/wsn/t-1" xmlns:ns6="http://www.onvif.org/ver10/device/wsdl" xmlns:ns7="http://www.onvif.org/ver10/events/wsdl" xmlns:ns9="http://docs.oasis-open.org/wsrf/r-2" xmlns:ns10="http://www.onvif.org/ver10/imaging/wsdl" xmlns:ns11="http://www.onvif.org/ver10/media/wsdl" xmlns:ns12="http://www.onvif.org/ver20/ptz/wsdl" xmlns:ns13="http://www.onvif.org/ver10/network/wsdl/" xmlns:ns14="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:ns16="http://www.onvif.org/ver10/analytics/wsdl/RuleEngineBinding" xmlns:ns17="http://www.onvif.org/ver10/analytics/wsdl/AnalyticsEngineBinding" xmlns:ns18="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding" xmlns:ns19="http://www.onvif.org/ver10/events/wsdl/EventBinding" xmlns:ns20="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding" xmlns:ns21="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" xmlns:ns22="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding" xmlns:ns23="http://www.onvif.org/ver10/events/wsdl/PullPointBinding" xmlns:ns24="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding" xmlns:ns25="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding" xmlns:ns26="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding" xmlns:ns27="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding" xmlns:ns28="http://www.onvif.org/ver10/events/wsdl/EventPortType" xmlns:ns29="http://www.3svision.com.tw/2009/event/topics"> <SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><ns11:GetProfilesResponse><ns11:Profiles token="Main_h264" fixed="true"><ns2:Name>Main h264</ns2:Name><ns2:VideoSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Main_h264"><ns2:Name>Main h264</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>H264</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:Quality>60</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>30</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:H264><ns2:GovLength>0</ns2:GovLength><ns2:H264Profile>Baseline</ns2:H264Profile></ns2:H264><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G7Ю11</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="Sub_h264" fixed="true"><ns2:Name>Sub h264</ns2:Name><ns2:VideoSourceConfiguration token="1"><ns2:Name>user1</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Sub_h264"><ns2:Name>Sub h264</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>H264</ns2:Encoding><ns2:Resolution><ns2:Width>640</ns2:Width><ns2:Height>352</ns2:Height></ns2:Resolution><ns2:Quality>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>30</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:H264><ns2:GovLength>0</ns2:GovLength><ns2:H264Profile>Baseline</ns2:H264Profile></ns2:H264><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="Motion_jpeg" fixed="true"><ns2:Name>Motion jpeg</ns2:Name><ns2:VideoSourceConfiguration token="2"><ns2:Name>user2</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Motion_jpeg"><ns2:Name>Motion jpeg</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>JPEG</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:QualitЭy>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>15</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="mc_test" fixed="false"><ns2:Name>mc_test</ns2:Name><ns2:VideoSourceConfiguration token="2"><ns2:Name>Hе</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Motion_jpeg"><ns2:Name>јч
#јч
#peg</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>JPEG</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:Quality>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>15</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="MACROSCOP" fixed="false"><ns2:Name>MACROSCOP</ns2:Name><ns2:VideoSourceConfiguration token="2"><ns2:Name>Hе</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" heightЮ="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Motion_jpeg"><ns2:Name>јч
#јч
#peg</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>JPEG</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:Quality>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>15</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles></ns11:GetProfilesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
At first, if Profile class is yourth, check the contract of your Profile object - maybe it hasn't well-configured DataContract attributes. If you have dll with Profile class, provided by the service owner, maybe it is of wrong version. YOu can try enabling WCF trace and compare caught XML with contract of Profile object (use dotPeek or any other decompiler to get class code from dll)
If the response from the web serivce is 200 OK in your sniffer and is failing in your client with the above exception then its worth trying to update your proxy. There might be a situation that the wsdl has changed and the response object being recieved is not in teh expected format on your client side