SOAP CustomTextMessageEncoder - c#

I am referncing a SOAP Service created in PHP from my .Net project, I had some issues with the encoding and was able to solve them using this library CustomTextMessageEncoder, https://code.msdn.microsoft.com/vstudio/Invoking-a-web-service-9714e53e/sourcecode?fileId=75606&pathId=391881754
https://learn.microsoft.com/en-us/dotnet/framework/wcf/samples/custom-message-encoder-custom-text-encoder
My web.config looks like this
<binding name="WSCalculadoraBinding" >
<customTextMessageEncoding encoding="ISO-8859-1"
messageVersion="Soap11"/>
<httpTransport />
</binding>
It works mostly very well, but for some specific data, it throws this exception
{
"Message": "Error.",
"ExceptionMessage": "Error al deserializar el cuerpo del mensaje de respuesta para la operación 'wsCotizar'.",
"ExceptionType": "System.ServiceModel.CommunicationException",
"StackTrace": "\r\nServer stack trace: \r\n en System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)\r\n en System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)\r\n en System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)\r\n en System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)\r\n en System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)\r\n en System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)\r\n en System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)\r\n en System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)\r\n en System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)\r\n\r\nException rethrown at [0]: \r\n en System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)\r\n en System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)\r\n en Cognos.Services.Baneco.Calculadora.WSCalculadoraPortType.wsCotizar(String login, String password, String tipodependencia, Int32 ingresos, String categoria, String otroscreditos, String cuotas, String alquiler, String tipobien, Int32 montobien, String moneda, Int32 monto, String tasa, Int32 plazo)\r\n en Cognos.Services.Baneco.Calculadora.WSCalculadoraPortTypeClient.wsCotizar(String login, String password, String tipodependencia, Int32 ingresos, String categoria, String otroscreditos, String cuotas, String alquiler, String tipobien, Int32 montobien, String moneda, Int32 monto, String tasa, Int32 plazo) en E:\\_Git\\Cognos.Services\\Service References\\Baneco.Calculadora\\Reference.cs:línea 231\r\n en Cognos.Services.Calculadora.Calculadora.Cotizar(String tipodependencia, Int32 ingresos, String categoria, String otroscreditos, String cuotas, String alquiler, String tipobien, Int32 montobien, String moneda, Int32 monto, String tasa, Int32 plazo) en E:\\_Git\\Cognos.Services\\Calculadora\\Calculadora.cs:línea 26\r\n en Cognos.Library.Baneco.Calculadora.Cotizar(String tipodependencia, Int32 ingresos, String categoria, String otroscreditos, String cuotas, String alquiler, String tipobien, Int32 montobien, String moneda, Int32 monto, String tasa, Int32 plazo) en E:\\_Git\\Cognos.Library\\Baneco\\Calculadora.cs:línea 20\r\n en Cognos.Negocio.Api.Controllers.Calculadora.CalculadoraController.Cotizar(String tipodependencia, Int32 ingresos, String categoria, String otroscreditos, String cuotas, String alquiler, String tipobien, Int32 montobien, String moneda, Int32 monto, String tasa, Int32 plazo) en E:\\_Git\\Cognos.Negocio.Api\\Controllers\\Calculadora\\CalculadoraController.cs:línea 19\r\n en lambda_method(Closure , Object , Object[] )\r\n en System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n en System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n en System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---\r\n en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n en System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---\r\n en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n en System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---\r\n en System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---\r\n en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n en System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---\r\n en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n en System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---\r\n en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n en System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---\r\n en System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---\r\n en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n en System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()",
"InnerException": {
"Message": "Error.",
"ExceptionMessage": "Error en el documento XML (1, 771).",
"ExceptionType": "System.InvalidOperationException",
"StackTrace": " en System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)\r\n en System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)",
"InnerException": {
"Message": "Error.",
"ExceptionMessage": "La cadena de entrada no tiene el formato correcto.",
"ExceptionType": "System.FormatException",
"StackTrace": " en System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)\r\n en System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)\r\n en System.Xml.Serialization.XmlSerializationReader.ReadTypedPrimitive(XmlQualifiedName type, Boolean elementCanBeType)\r\n en System.Xml.Serialization.XmlSerializationReader.ReadReferencingElement(String name, String ns, Boolean elementCanBeType, String& fixupReference)\r\n en Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderWSCalculadoraPortType.Read1_Resp_Cotizar()\r\n en System.Xml.Serialization.XmlSerializationReader.ReadReferencingElement(String name, String ns, Boolean elementCanBeType, String& fixupReference)\r\n en Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderWSCalculadoraPortType.Read5_wsCotizarResponse()\r\n en Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer1.Deserialize(XmlSerializationReader reader)\r\n en System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)"
}
}
}

The problem was in the service side, the php service was not handling exceptions properly so the service itself was failing due the exception.
In other words the CustomTextMessageEncoder was/is working properly but the code in the php service was wrong/poor written.

Related

Azure.Identity.AuthenticationFailedException: Response was not set, make sure SendAsync was called

I'm trying to connect to an Azure Service Bus and I'm facing an issue.
It seems impossible to connect as I always get this error:
Azure.Identity.AuthenticationFailedException: ClientSecretCredential authentication failed: Response was not set, make sure SendAsync was called
Here is a code snippet of what I'm trying to do
var adminClient = new ServiceBusAdministrationClient(
mySettings.AzureServiceBus.Endpoint,
new ClientSecretCredential(mySettings.AzureServiceBus.TenantId,
mySettings.AzureServiceBus.ClientId, mySettings.AzureServiceBus.ClientSecret));
var exists = await adminClient.SubscriptionExistsAsync(myTopic, mySubName).ConfigureAwait(false);
Diagnostics from AzureEventSourceListener:
[Informational] Azure-Identity: ClientSecretCredential.GetToken invoked. Scopes: [ https://servicebus.azure.net/.default ] ParentRequestId: 8cd8075d-fb77-4479-bf12-d612fff0de99
[Informational] Azure-Identity: (False) MSAL 4.30.1.0 MSAL.Desktop Windows 10 Enterprise [02/01/2023 23:46:30 - ] MSAL MSAL.Desktop with assembly version '4.30.1.0'. CorrelationId(e1994990-3e32-43b9-83e5-55a325de668a)
[Informational] Azure-Identity: (False) MSAL 4.30.1.0 MSAL.Desktop Windows 10 Enterprise [02/01/2023 23:46:30 - ] === AcquireTokenForClientParameters ===
SendX5C: False
ForceRefresh: False
[Informational] Azure-Identity: (False) MSAL 4.30.1.0 MSAL.Desktop Windows 10 Enterprise [02/01/2023 23:46:30 - ]
=== Request Data ===
Authority Provided? - True
Scopes - https://servicebus.azure.net/.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenForClient
IsConfidentialClient - True
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - e1994990-3e32-43b9-83e5-55a325de668a
[Informational] Azure-Identity: (False) MSAL 4.30.1.0 MSAL.Desktop Windows 10 Enterprise [02/01/2023 23:46:30 - ] === Token Acquisition (ClientCredentialRequest) started:
Authority Host: login.microsoftonline.com
[Informational] Azure-Identity: (False) MSAL 4.30.1.0 MSAL.Desktop Windows 10 Enterprise [02/01/2023 23:46:30 - ] Azure region was not configured or could not be discovered. Not using a regional authority.
[Informational] Azure-Identity: (False) MSAL 4.30.1.0 MSAL.Desktop Windows 10 Enterprise [02/01/2023 23:46:30 - ] Azure region was not configured or could not be discovered. Not using a regional authority.
[Informational] Azure-Identity: (False) MSAL 4.30.1.0 MSAL.Desktop Windows 10 Enterprise [02/01/2023 23:46:30 - ] Fetching instance discovery from the network from host login.microsoftonline.com.
[Informational] Azure-Core: Request [76254b44-7f17-42bc-9810-ae56aab73c66] GET https://login.microsoftonline.com/common/discovery/instance?api-version=REDACTED&authorization_endpoint=REDACTED
x-client-SKU:REDACTED
x-client-Ver:REDACTED
x-client-CPU:REDACTED
x-client-OS:REDACTED
client-request-id:REDACTED
return-client-request-id:REDACTED
x-app-name:REDACTED
x-app-ver:REDACTED
x-ms-client-request-id:REDACTED
x-ms-return-client-request-id:REDACTED
User-Agent:REDACTED
client assembly: Azure.Identity
[Informational] Azure-Core: Request [76254b44-7f17-42bc-9810-ae56aab73c66] exception System.InvalidOperationException: Response was not set, make sure SendAsync was called
à Azure.Core.HttpMessage.get_Response()
à System.Diagnostics.DiagnosticSourceEventSource.TransformSpec.PropertySpec.PropertyFetch.RefTypedFetchProperty2.Fetch(Object obj) à System.Diagnostics.DiagnosticSourceEventSource.TransformSpec.PropertySpec.Fetch(Object obj) à System.Diagnostics.DiagnosticSourceEventSource.TransformSpec.Morph(Object obj) à System.Diagnostics.DiagnosticSourceEventSource.FilterAndTransform.Morph(Object args) à System.Diagnostics.DiagnosticSourceEventSource.FilterAndTransform.<>c__DisplayClass2_1.<.ctor>b__2(KeyValuePair2 evnt)
à System.Diagnostics.DiagnosticSourceEventSource.CallbackObserver`1.OnNext(T value)
à System.Diagnostics.DiagnosticListener.Write(String name, Object value)
à Azure.Core.Pipeline.DiagnosticScope.ActivityAdapter.Dispose()
à Azure.Core.Pipeline.DiagnosticScope.Dispose()
à Azure.Core.Pipeline.RequestActivityPolicy.d__11.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable.ConfiguredValueTaskAwaiter.GetResult()
à Azure.Core.Pipeline.ResponseBodyPolicy.d__5.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable.ConfiguredValueTaskAwaiter.GetResult()
à Azure.Core.Pipeline.LoggingPolicy.d__9.MoveNext()
[Error] Azure-Identity: (False) MSAL 4.30.1.0 MSAL.Desktop Windows 10 Enterprise [02/01/2023 23:46:30 - ] Exception type: System.InvalidOperationException
à Azure.Core.HttpMessage.get_Response()
à System.Diagnostics.DiagnosticSourceEventSource.TransformSpec.PropertySpec.PropertyFetch.RefTypedFetchProperty2.Fetch(Object obj) à System.Diagnostics.DiagnosticSourceEventSource.TransformSpec.PropertySpec.Fetch(Object obj) à System.Diagnostics.DiagnosticSourceEventSource.TransformSpec.Morph(Object obj) à System.Diagnostics.DiagnosticSourceEventSource.FilterAndTransform.Morph(Object args) à System.Diagnostics.DiagnosticSourceEventSource.FilterAndTransform.<>c__DisplayClass2_1.<.ctor>b__2(KeyValuePair2 evnt)
à System.Diagnostics.DiagnosticSourceEventSource.CallbackObserver1.OnNext(T value) à System.Diagnostics.DiagnosticListener.Write(String name, Object value) à Azure.Core.Pipeline.DiagnosticScope.ActivityAdapter.Dispose() à Azure.Core.Pipeline.DiagnosticScope.Dispose() à Azure.Core.Pipeline.RequestActivityPolicy.<ProcessAsync>d__11.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable.ConfiguredValueTaskAwaiter.GetResult() à Azure.Core.Pipeline.ResponseBodyPolicy.<ProcessAsync>d__5.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable.ConfiguredValueTaskAwaiter.GetResult() à Azure.Core.Pipeline.LoggingPolicy.<ProcessAsync>d__9.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable.ConfiguredValueTaskAwaiter.GetResult() à Azure.Core.Pipeline.RedirectPolicy.<ProcessAsync>d__5.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable.ConfiguredValueTaskAwaiter.GetResult() à Azure.Core.Pipeline.RetryPolicy.<ProcessAsync>d__11.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() à Azure.Core.Pipeline.RetryPolicy.<ProcessAsync>d__11.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable.ConfiguredValueTaskAwaiter.GetResult() à Azure.Core.Pipeline.HttpPipeline.<SendRequestAsync>d__11.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Threading.Tasks.ValueTask1.get_Result()
à System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable1.ConfiguredValueTaskAwaiter.GetResult() à Azure.Core.HttpPipelineMessageHandler.<SendAsync>d__2.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
à System.Net.Http.HttpClient.d__58.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() à Microsoft.Identity.Client.Http.HttpManager.<ExecuteAsync>d__10.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
à Microsoft.Identity.Client.Http.HttpManager.d__8.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() à Microsoft.Identity.Client.Http.HttpManager.<SendGetAsync>d__5.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
à Microsoft.Identity.Client.OAuth2.OAuth2Client.d__111.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
à Microsoft.Identity.Client.OAuth2.OAuth2Client.d__9.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() à Microsoft.Identity.Client.Instance.Discovery.NetworkMetadataProvider.<SendInstanceDiscoveryRequestAsync>d__7.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
à Microsoft.Identity.Client.Instance.Discovery.NetworkMetadataProvider.d__6.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() à Microsoft.Identity.Client.Instance.Discovery.NetworkMetadataProvider.<GetMetadataAsync>d__4.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
à Microsoft.Identity.Client.Instance.Discovery.InstanceDiscoveryManager.d__10.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() à Microsoft.Identity.Client.Instance.Discovery.InstanceDiscoveryManager.<GetMetadataEntryAsync>d__9.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
à Microsoft.Identity.Client.Instance.AuthorityManager.d__9.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
à Microsoft.Identity.Client.Internal.Requests.ClientCredentialRequest.d__3.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() à Microsoft.Identity.Client.Internal.Requests.ClientCredentialRequest.<ExecuteAsync>d__2.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
à Microsoft.Identity.Client.Internal.Requests.RequestBase.d__13.MoveNext()
[Informational] Azure-Identity: ClientSecretCredential.GetToken was unable to retrieve an access token. Scopes: [ https://servicebus.azure.net/.default ] ParentRequestId: 8cd8075d-fb77-4479-bf12-d612fff0de99 Exception: Azure.Iden
tity.AuthenticationFailedException (0x80131500): ClientSecretCredential authentication failed: Response was not set, make sure SendAsync was called
---> System.InvalidOperationException (0x80131509): Response was not set, make sure SendAsync was called
Day to day I'm using Jetbrains Rider on Win 11. It fails everytime.
Strangely I managed to make it work after navigating through the client properties in the debugger.
I can't say what properties, if it forced evaluating something, but I made it works, not everytime.
I asked a collegue of mine to try it, he's using Visual Studio and it never fails. So I installed VStudio Community to give it a try, and... it works... Cannot explain the difference.
Try updating System.Diagnostics.DiagnosticSource to version 6.0.0.
This appears to have been fixed by this PR

IdentityModel - RequestClientCredentialsTokenAsync

This method RequestClientCredentialsTokenAsync to generate token (oauth2) works fine for me when I call it from unit test, but from the API MVC .Net Framework 4.6.1 I have this exception : ( I am sorry, the exception is in french language)
<Error>
<Message>
Une erreur s'est produite lors de l'envoi de la demande.
</Message>
<ExceptionMessage>
Une erreur s'est produite lors de l'envoi de la demande.
</ExceptionMessage>
<ExceptionType>System.InvalidOperationException</ExceptionType>
<StackTrace>
à JwtBearerAuthentication.JwtAssertionTokenManager.AcquireAccessToken() dans C:\Users\S851029\source\repos\Sources\AF.EFormSignature.JwtBearerAuthentication\JwtAssertionTokenManager.cs:ligne 55 à JwtBearerAuthentication.JwtAssertionTokenManager.GetAccessToken(Boolean forceRefresh) dans C:\Users\S851029\source\repos\Sources\AF.EFormSignature.JwtBearerAuthentication\JwtAssertionTokenManager.cs:ligne 28 à AF.EFormSignature.Web.Controllers.IdentiteNumeriqueController.RecuperationStatutIdentite() dans C:\Users\S851029\source\repos\Sources\AF.EFormSignature.Web\Controllers\IdentiteNumeriqueController.cs:ligne 72 à lambda_method(Closure , Object , Object[] ) à System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters) à System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) à System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken) --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.MoveNext() --- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée --- à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à System.Web.Http.Controllers.ExceptionFilterResult.d__0.MoveNext()
An error has occurred.
Une erreur s'est produite lors de l'envoi de la demande.
System.Net.Http.HttpRequestException
à System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) à IdentityModel.Client.HttpClientTokenRequestExtensions.d__7.MoveNext()
An error has occurred.
Impossible de se connecter au serveur distant
System.Net.WebException
à System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context) à System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
An error has occurred.
Une tentative de connexion a échoué car le parti connecté n’a pas répondu convenablement au-delà d’une certaine durée ou une connexion établie a échoué car l’hôte de connexion n’a pas répondu 171.18.28.75:443
System.Net.Sockets.SocketException
à System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult) à System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) à System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
private string AcquireAccessToken()
{
// Build assertion
var authenticationToken = GetAuthenticationToken();
HttpClientHandler handler = new HttpClientHandler();
handler.DefaultProxyCredentials = CredentialCache.DefaultCredentials;
HttpMessageInvoker msg = new HttpMessageInvoker(handler);
TokenClientOptions tokenClientOptions = new TokenClientOptions();
tokenClientOptions.Address = TokenEndpointUrl;
tokenClientOptions.ClientId = ClientId;
tokenClientOptions.ClientSecret = ClientSecret;
TokenClient tokenClient = new TokenClient(msg, tokenClientOptions);
var payload = new Dictionary<string, string> {
{ "client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" },
{ "client_assertion", authenticationToken }
};
// Send authorization parameters using HTTP POST method and the Form Serialization
// See http://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication
var tokenResponse = tokenClient.RequestClientCredentialsTokenAsync(Scope, payload);
if (tokenResponse.Result.IsError)
{
throw new InvalidOperationException(tokenResponse.Result.Exception.Message, tokenResponse.Result.Exception);
}
var accessToken = tokenResponse.Result.AccessToken;
// Get token expiration date to configure cache expiration
var accessTokenExpiration = GetTokenExpirationDate(accessToken);
// Cache access token to prevent calling MAAM server for each request
WriteTokenToCache(GenerateTokenCacheKey(), accessToken, new DateTimeOffset(accessTokenExpiration));
return accessToken;
}

Getting name associated with province(AdventureWorks2014) exception

im doing test using the AdventureWorks2014 microsoft database with visual studio(coding in C#).I am trying to input StateProvinceID and then display the names(Person.FirstName) that are associated with this StateProvinceID.So far I did this:
static public void provincequery()
{
Console.WriteLine("Enter province ID");
var theid = Convert.ToInt32(Console.ReadLine());
using (var context = new Model1())
{
var queryprovince = from test in context.StateProvince
where test.StateProvinceID == theid
select test;
foreach(var disp in queryprovince)
{
Console.WriteLine("\nProvince:");
Console.WriteLine(disp.Name);
foreach(var test2 in disp.SalesTerritory.Customer)
{
Console.WriteLine(test2.Person.FirstName);
}
}
}
}
however this keeps returning me an error "An error occurred while executing the command definition. See the inner exception for details."
inner exception:
à System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
à System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
à System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__6()
à System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
à System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
à System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
à System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
à System.Data.Entity.Core.Objects.ObjectQuery`1.Execute(MergeOption mergeOption)
à System.Data.Entity.Core.Objects.DataClasses.EntityReference`1.Load(MergeOption mergeOption)
à System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.DeferredLoad()
à System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.LoadProperty[TItem](TItem propertyValue, String relationshipName, String targetRoleName, Boolean mustBeNull, Object wrapperObject)
à System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.<>c__DisplayClass7`2.<GetInterceptorDelegate>b__2(TProxy proxy, TItem item)
à System.Data.Entity.DynamicProxies.StateProvince_0A13F786927514ECF26BEB6F7007442E73C1FCAA3A743679986FA051D479F5AA.get_SalesTerritory()
à ConsoleApplication1.Program.requete2() dans c:\Users\julianp\Desktop\ConsoleApplication1\ConsoleApplication1\Program.cs:ligne 152
à ConsoleApplication1.Program.Main(String[] args) dans c:\Users\julianp\Desktop\ConsoleApplication1\ConsoleApplication1\Program.cs:ligne 33
à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
à System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
à System.Threading.ThreadHelper.ThreadStart()
I dont really understand why its not working.AdventureWorks schema can be found here:
https://moidulhassan.files.wordpress.com/2014/07/adventureworks2008_schema.gif
thank you
Solved; needed to add ToList() at the end of foreach(var disp in queryprovince).
So its foreach(var disp in queryprovince.ToList())

Sterling exception on dispose after saveAsync thousands records

I'm trying to populate a sterling db from a SQL db, so I query the SQL get about 6000
_engine = new SterlingEngine(new PlatformAdapter());
_engine.Activate();
string folder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
_databaseInstance = _engine.SterlingDatabase.RegisterDatabase<TCP.Datosejemplol.Sterling.ejemploDatos>("ejemploDatos", new FileSystemDriver(#"E:\pruebaSterling\Otrofolder"));
BLL.Contextos.ContextoIndices manejoIndices = new BLL.Contextos.ContextoIndices(new BLL.SQL.ManejoIndices());
var DatosCompleto = manejoIndices.DatosCompleto();
foreach (var indiceBase in DatosCompleto)
{
var indice = new TCP.Datosejemplol.Sterling.Entidades.Indice()
{
IdIndice = indiceBase.IdIndice,
Nombre = indiceBase.Nombre,
NombreCompleto = indiceBase.NombreCompleto,
IdIndice_padre = indiceBase.IdIndice_padre,
EsPadre = indiceBase.EsPadre
};
_databaseInstance.SaveAsync<TCP.Datosejemplol.Sterling.Entidades.Indice>(indice);
}
It seems to work fine, but when closing the connection with _engine.Dispose();
I get the following exception:
InnerException: System.NullReferenceException
HResult=-2147467261
Message=Referencia a objeto no establecida como instancia de un objeto.
Source=Wintellect.Sterling.Core
StackTrace:
en Wintellect.Sterling.Core.Serialization.AggregateSerializer.Serialize(Object target, BinaryWriter writer) en e:\Proyectos\Sistematizacion\Codigo\TCP.ArbolJurisprudencial\Wintellect.Sterling.Core\Serialization\AggregateSerializer.cs:línea 114
en Wintellect.Sterling.Server.FileSystem.FileSystemDriver.<SerializeIndexAsync>d__c`2.MoveNext() en e:\Proyectos\Sistematizacion\Codigo\TCP.ArbolJurisprudencial\Wintellect.Sterling.Server\FileSystem\FileSystemDriver.cs:línea 129
--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---
en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
en System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
en Wintellect.Sterling.Core.Indexes.IndexCollection`3.<SerializeIndexesAsync>d__8.MoveNext() en e:\Proyectos\Sistematizacion\Codigo\TCP.ArbolJurisprudencial\Wintellect.Sterling.Core\Indexes\IndexCollection.cs:línea 92
--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---
en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
en System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
en Wintellect.Sterling.Core.Indexes.IndexCollection`3.<FlushAsync>d__c.MoveNext() en e:\Proyectos\Sistematizacion\Codigo\TCP.ArbolJurisprudencial\Wintellect.Sterling.Core\Indexes\IndexCollection.cs:línea 104
--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---
en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
en System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
en Wintellect.Sterling.Core.Database.BaseDatabaseInstance.<FlushAsync>d__27.MoveNext() en e:\Proyectos\Sistematizacion\Codigo\TCP.ArbolJurisprudencial\Wintellect.Sterling.Core\Database\BaseDatabaseInstance.cs:línea 633
I've tried to check on the saveAsync BackgroundWorker if it's completed, and everytime it is.
If I try to save less items in every session everything works fine.
so my question is:
Is there a way to know if the saving has not finished?
Please advice.
BR
Jorge

How to make work ConfigSection?

I'm facing a serious issue here, I'm trying to configure a new section for my web app and after trying 10 thousands different things I think it's better if I make my own post.
Here is my code :
<configSections>
<section name="EmailConfigurationSection"
type="ServiceEmail.Helper.EmailConfigurationSection, ServiceEmail.Helper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</configSections>
<EmailConfigurationSection isDebug="true"
smtpAddress="***"
smtpLogin="***"
smtpPassword="***"
smtpPort="***"
emailPersonForTest="***#***.lu"/>
public class EmailConfigurationSection : ConfigurationSection
{
private static readonly EmailConfigurationSection settings = ConfigurationManager.GetSection("EmailConfigurationSection") as EmailConfigurationSection;
public static EmailConfigurationSection EmailConfiguration
{
get { return settings; }
}
[ConfigurationProperty("isDebug", DefaultValue = "false", IsRequired = false)]
public Boolean IsDebug
{
get { return (Boolean) this["isDebug"]; }
set { this["isDebug"] = value; }
}
}
... I have here all the property defined in my web.config
Everytime I tried to access a property, I got a NullReferenceException on EmailConfiguration
I already set my web.conf for it to be copied in the output directory.
After using NameCollectionValue I get that :
Une exception a été levée par l'initialiseur de type pour 'ServiceEmail.Helper.EmailConfigurationSection'. --System.Configuration.ConfigurationErrorsException: Une erreur s'est produite lors de la création du gestionnaire de section de configuration pour EmailConfigurationSection : Impossible de charger le fichier ou l'assembly 'ServiceEmail.Helper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ou une de ses dépendances. Le fichier spécifié est introuvable. (C:\inetpub\wwwroot\Service_Mails\web.config line 8) ---> System.IO.FileNotFoundException: Impossible de charger le fichier ou l'assembly 'ServiceEmail.Helper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ou une de ses dépendances. Le fichier spécifié est introuvable.
à System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost host, String typeString, Boolean throwOnError)
à System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
à System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
à System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord)
à System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
--- Fin de la trace de la pile d'exception interne ---
à System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
à System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
à System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
à System.Configuration.ConfigurationManager.GetSection(String sectionName)
à ServiceEmail.Helper.EmailConfigurationSection..cctor() dans C:\Users\***\documents\visual studio 2010\Projects\ServiceEmail\ServiceEmail\Helper\EmailConfigurationSection.cs:ligne 14 --ServiceEmail
update :
From your edit, it seems you have an error in your type attribute. Make sure the dll name is really ServiceEmail.Helper.dll. It might just be ServiceEmail.dll
You may be trying to initialize your settings too early.
Maybe you can try to replace
private static readonly EmailConfigurationSection settings = ConfigurationManager.GetSection("EmailConfigurationSection") as EmailConfigurationSection;
public static EmailConfigurationSection EmailConfiguration
{
get
{
return settings;
}
}
with :
public static EmailConfigurationSection EmailConfiguration
{
get
{
return ConfigurationManager.GetSection("EmailConfigurationSection") as EmailConfigurationSection;
}
}
Could you please try with following ?
EmailConfigurationSectionloc =
(EmailConfigurationSection)ConfigurationSettings.GetConfig("EmailConfigurationSection");

Categories