I have a problem with my .NET Core 3.1 application that connects to Dynamics. The error occurs when connecting to dynamics using the ServiceClient class, but it does not happen all the time and is not random. I am having trouble pinpointing the cause of the issue.
This is the error message I get when the application tries to connect:
2023-01-16T07:22:43.189 [Error] Executed 'CreateCustomerTimelineHttpTrigger' (Failed, Id=a36dba87-30c3-4dab-93b3-7a00aeba4de3, Duration=2346ms)Microsoft.PowerPlatform.Dataverse.Client.Utils.DataverseConnectionException : Failed to connect to Dataverse
---> System.AggregateException : One or more errors occurred. (Exception - Fault While initializing client - RefreshInstanceDetails)
---> Exception - Fault While initializing client - RefreshInstanceDetails
---> Exception - Failed to lookup current organization data
---> A proxy type with the name msdyncrm_GetReactions has been defined by another assembly.
Current type: CrmEarlyBound.msdyncrm_GetReactionsResponse, CEP.CustomerTimeline.API, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, Existing type: CrmEarlyBound.msdyncrm_GetReactionsResponse, CEP.CustomerTimeline.API, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null (Parameter 'msdyncrm_GetReactions')
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)at System.Threading.Tasks.Task`1.get_Result()
at Microsoft.PowerPlatform.Dataverse.Client.ConnectionService.GetCachedService(ConnectionService& ConnectionObject)
at Microsoft.PowerPlatform.Dataverse.Client.ConnectionService.IntilizeService(ConnectionService& ConnectionObject)
at Microsoft.PowerPlatform.Dataverse.Client.ServiceClient.CreateServiceConnection(Object externalOrgServiceProxy,AuthenticationType requestedAuthType,String hostName,String port,String orgName,NetworkCredential credential,String userId,SecureString password,String domain,String Geo,String claimsHomeRealm,Boolean useSsl,Boolean useUniqueInstance,OrganizationDetail orgDetail,String clientId,Uri redirectUri,PromptBehavior promptBehavior,OrganizationWebProxyClientAsync externalOrgWebProxyClient,String certificateThumbPrint,StoreName certificateStoreName,X509Certificate2 certificate,Uri instanceUrl,Boolean isCloned,Boolean useDefaultCreds,Version incomingOrgVersion,ILogger externalLogger,String tokenCacheStorePath)
---> (Inner Exception #0) Microsoft.PowerPlatform.Dataverse.Client.Utils.DataverseConnectionException : Exception - Fault While initializing client - RefreshInstanceDetails
---> Microsoft.PowerPlatform.Dataverse.Client.Utils.DataverseOperationException : Exception - Failed to lookup current organization data
---> System.ArgumentException : A proxy type with the name msdyncrm_GetReactions has been defined by another assembly. Current type: CrmEarlyBound.msdyncrm_GetReactionsResponse, CEP.CustomerTimeline.API, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, Existing type: CrmEarlyBound.msdyncrm_GetReactionsResponse, CEP.CustomerTimeline.API, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null (Parameter 'msdyncrm_GetReactions')
at Microsoft.Xrm.Sdk.AppDomainBasedKnownProxyTypesProvider.AddTypeMapping(Assembly assembly,Type type,String proxyName)
at Microsoft.Xrm.Sdk.KnownProxyTypesProvider.LoadKnownTypes(Assembly assembly)
at Microsoft.Xrm.Sdk.KnownProxyTypesProvider.RegisterAssembly(Assembly assembly)at Microsoft.Xrm.Sdk.KnownProxyTypesProvider.InitializeLoadedAssemblies()
at Microsoft.Xrm.Sdk.AppDomainBasedKnownProxyTypesProvider..ctor()
at Microsoft.Xrm.Sdk.KnownProxyTypesProvider.GetInstance(Boolean supportIndividualAssemblies)
at Microsoft.Xrm.Sdk.ProxySerializationSurrogate.System.Runtime.Serialization.ISerializationSurrogateProvider.GetObjectToSerialize(Object obj,Type targetType)
at System.Runtime.Serialization.DataContractSerializer.SurrogateToDataContractType(ISerializationSurrogateProvider serializationSurrogateProvider,Object oldObj,Type surrogatedDeclaredType,Type& objType)
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.Channels.Message.OnWriteMessage(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.BufferedMessageWriter.WriteMessage(Message message,BufferManager bufferManager,Int32 initialOffset,Int32 maxSizeQuota)
at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessageAsync(Message message,Int32 maxMessageSize,BufferManager bufferManager,Int32 messageOffset)
at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessage(Message message,Int32 maxMessageSize,BufferManager bufferManager,Int32 messageOffset)
at System.ServiceModel.Channels.BufferedMessageContent.EnsureMessageEncoded()
at System.ServiceModel.Channels.BufferedMessageContent.TryComputeLength(Int64& length)
at System.Net.Http.HttpContent.GetComputedOrBufferLength()
at System.Net.Http.Headers.HttpContentHeaders.get_ContentLength()
at System.Net.Http.SocketsHttpHandler.ValidateAndNormalizeRequest(HttpRequestMessage request)
at System.Net.Http.SocketsHttpHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
at async System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask,HttpRequestMessage request,CancellationTokenSource cts,Boolean disposeCts)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async System.ServiceModel.Channels.HttpChannelFactory`1.HttpClientRequestChannel.HttpClientChannelAsyncRequest.SendRequestAsync[TChannel](Message message,TimeoutHelper timeoutHelper)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async System.ServiceModel.Channels.RequestChannel.RequestAsync(??)at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async System.ServiceModel.Channels.RequestChannel.RequestAsyncInternal(Message message,TimeSpan timeout)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.TaskHelpers.WaitForCompletionNoSpin[TResult](Task`1 task)at System.ServiceModel.Channels.RequestChannel.Request(Message message,TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message,TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action,Boolean oneway,ProxyOperationRuntime operation,Object[] ins,Object[] outs,TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(MethodCall methodCall,ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(MethodInfo targetMethod,Object[] args)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Reflection.DispatchProxyGenerator.Invoke(Object[] args)
at generatedProxy_1.Execute(OrganizationRequest )
at Microsoft.PowerPlatform.Dataverse.Client.Connector.OrganizationWebProxyClientAsync.<>c__DisplayClass52_0.<ExecuteCore>b__0()
at Microsoft.PowerPlatform.Dataverse.Client.Connector.WebProxyClientAsync`1.ExecuteAction[TResult](Func`1 action)
at Microsoft.PowerPlatform.Dataverse.Client.Connector.OrganizationWebProxyClientAsync.ExecuteCore(OrganizationRequest request)
at Microsoft.PowerPlatform.Dataverse.Client.Connector.OrganizationWebProxyClientAsync.Execute(OrganizationRequest request)
at async Microsoft.PowerPlatform.Dataverse.Client.ConnectionService.RefreshInstanceDetails(IOrganizationService dvService,Uri uriOfInstance)
End of inner exception
at async Microsoft.PowerPlatform.Dataverse.Client.ConnectionService.RefreshInstanceDetails(IOrganizationService dvService,Uri uriOfInstance)
End of inner exception
at async Microsoft.PowerPlatform.Dataverse.Client.ConnectionService.RefreshInstanceDetails(IOrganizationService dvService,Uri uriOfInstance)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.PowerPlatform.Dataverse.Client.ConnectionService.DoDirectLoginAsync(Boolean IsOnPrem)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.PowerPlatform.Dataverse.Client.ConnectionService.InitServiceAsync()<---
End of inner exception
at Microsoft.PowerPlatform.Dataverse.Client.ServiceClient.CreateServiceConnection(Object externalOrgServiceProxy,AuthenticationType requestedAuthType,String hostName,String port,String orgName,NetworkCredential credential,String userId,SecureString password,String domain,String Geo,String claimsHomeRealm,Boolean useSsl,Boolean useUniqueInstance,OrganizationDetail orgDetail,String clientId,Uri redirectUri,PromptBehavior promptBehavior,OrganizationWebProxyClientAsync externalOrgWebProxyClient,String certificateThumbPrint,StoreName certificateStoreName,X509Certificate2 certificate,Uri instanceUrl,Boolean isCloned,Boolean useDefaultCreds,Version incomingOrgVersion,ILogger externalLogger,String tokenCacheStorePath)
at Microsoft.PowerPlatform.Dataverse.Client.ServiceClient..ctor(Uri instanceUrl,String clientId,String clientSecret,Boolean useUniqueInstance,ILogger logger)
at CEP.CustomerTimeline.API.Repositories.DynamicsRepository..ctor(IOptions`1 options)
at D:\a\1\s\CEP.CustomerTimeline.API\Repositories\DynamicsRepository.cs : 19at lambda_method(Closure )at DryIoc.Scope.TryGetOrAdd(ImMap`1 items,Int32 id,CreateScopedValue createValue,Int32 disposalOrder)
at D:\a\_work\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7856at DryIoc.Scope.GetOrAdd(Int32 id,CreateScopedValue createValue,Int32 disposalOrder)
at D:\a\_work\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7841at lambda_method(Closure )
at DryIoc.Scope.TryGetOrAdd(ImMap`1 items,Int32 id,CreateScopedValue createValue,Int32 disposalOrder)
at D:\a\_work\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7856at DryIoc.Scope.GetOrAdd(Int32 id,CreateScopedValue createValue,Int32 disposalOrder)
at D:\a\_work\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7841at lambda_method(Closure )
at DryIoc.Scope.TryGetOrAdd(ImMap`1 items,Int32 id,CreateScopedValue createValue,Int32 disposalOrder)
at D:\a\_work\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7856at DryIoc.Scope.GetOrAdd(Int32 id,CreateScopedValue createValue,Int32 disposalOrder)
at D:\a\_work\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7841at lambda_method(Closure )
at DryIoc.Scope.TryGetOrAdd(ImMap`1 items,Int32 id,CreateScopedValue createValue,Int32 disposalOrder)
at D:\a\_work\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7856
at DryIoc.Scope.GetOrAdd(Int32 id,CreateScopedValue createValue,Int32 disposalOrder)
at D:\a\_work\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7841at lambda_method(Closure )
at DryIoc.Scope.TryGetOrAdd(ImMap`1 items,Int32 id,CreateScopedValue createValue,Int32 disposalOrder)
at D:\a\_work\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7856at DryIoc.Scope.GetOrAdd(Int32 id,CreateScopedValue createValue,Int32 disposalOrder)
at D:\a\_work\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7841at lambda_method(Closure ,IResolverContext )
at DryIoc.Container.ResolveAndCacheDefaultFactoryDelegate(Type serviceType,IfUnresolved ifUnresolved)
at D:\a\_work\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 225at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType,IfUnresolved ifUnresolved)
at D:\a\_work\1\s\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 196
at Microsoft.Azure.WebJobs.Script.WebHost.DependencyInjection.ScopedServiceProvider.GetService(Type serviceType)
at D:\a\_work\1\s\src\WebJobs.Script.WebHost\DependencyInjection\ScopedServiceProvider.cs : 25
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp,Type type,Type requiredBy,Boolean isDefaultParameterRequired)at lambda_method(Closure ,IServiceProvider ,Object[] )
at Microsoft.Azure.WebJobs.Host.Executors.DefaultJobActivator.CreateInstance[T](IServiceProvider serviceProvider) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\DefaultJobActivator.cs : 42
at Microsoft.Azure.WebJobs.Host.Executors.DefaultJobActivator.CreateInstance[T](IFunctionInstanceEx functionInstance) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\DefaultJobActivator.cs : 32
at Microsoft.Azure.WebJobs.Host.Executors.ActivatorInstanceFactory`1.<>c__DisplayClass1_1.<.ctor>b__0(IFunctionInstanceEx i)
at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\ActivatorInstanceFactory.cs : 20
at Microsoft.Azure.WebJobs.Host.Executors.ActivatorInstanceFactory`1.Create(IFunctionInstanceEx functionInstance) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\ActivatorInstanceFactory.cs : 26
at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.CreateInstance(IFunctionInstanceEx functionInstance) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs : 44
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ParameterHelper.Initialize() at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 793
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance,CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 104
I have seen posts regarding this error when using .NET Framework NuGets, the solution from them are either not applicable or have not worked. I am no expert when it comes to dynamics, my main focus are on integrations so I am at a loss here.
The error occurs when the applications FunctionStartup is running and the repository class, with the connection, is initiated. The connection is done with a scoped lifetime and the same connection is used for all operations towards Dyncamics (I have tried to use one connection per entity as well).
Observations I have made so far:
The earlybound seems to have something to do with the issue, since if I move over to latebound and delete the earlybound files, the issue dissapears. But I have other solutions using the earlybound in combination with ServiceClient that is working fine
The issue seems to be related with the dynamics instance that it connects to as well, as it does not happen for our DEV environment, but occurs in SIT
Removing the type that is causing the issue causes the same error but for a different type
It works locally, it is not until I deploy it to my function app that the crash occurs
A simple restart of the function app will resolve the issue
My reflection is that the earlybound is conflicting with some other component as removing it removes the issue. It is the unknown component that I am looking for and part of me is looking towards dynamics, as it works in one environment and not the other and it is always the same environment it works for.
Any help or insight into this would be greatly appreciated. Please let me know if there are further questions on this.
Thank you!
---> A proxy type with the name msdyncrm_GetReactions has been defined by another assembly.
You are correct, that this is the relevant part of the error.
That that you're not seeing it locally, and or you're not seeing it on the restart of a function indicates that you're dynamically loading a lib during runtime. ( are you? )
if so that lib has the same types as the root function has + the assembly attribute
[assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()]
That attribute causes the client to attempt to load the types of that assembly into the type mapper used by the client.
its only usefull if your using Linq operations based on the organization service context.
if your not using linq, the easiest way to fix this is to remove the assembly attribute above.
I was able to successfully integrate the elastic search sink in my .net app, now I am trying to setup the FailureCallback option but every time there is an error the exception in LogEvent is null, I can see the actual error in the console but I want to be able to capture this exception in my failure callback function, here is my current configuration:
myLogger = new LoggerConfiguration()
.WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri(elasticSearchUrl))
{
AutoRegisterTemplate = true,
AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv6,
IndexDecider = (#event, dateTimeOffset) =>
{
//some logic here
return $"custom-index";
},
EmitEventFailure = EmitEventFailureHandling.WriteToSelfLog | EmitEventFailureHandling.RaiseCallback,
FailureCallback = HandleElasticError
})
.Enrich.WithProperty("Environment", Config.Environment)
.Destructure.ByTransforming<ExpandoObject>(JsonConvert.SerializeObject)
.CreateLogger();
Here is my HandleElasticError function:
private void HandleElasticError(LogEvent e)
{
FileLogger.Error(e.Exception, e.MessageTemplate.Text, e.Properties);
}
When I attach the debugger and inspect the LogEvent, exception is null, however in the output window in Visual Studio I can see the actual error:
2020-11-30T20:55:07.7820674Z Caught exception while preforming bulk operation to Elasticsearch: Elasticsearch.Net.ElasticsearchClientException: The underlying connection was closed: An unexpected error occurred on a send.. Call: Status code unknown from: POST /_bulk ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: The handshake failed due to an unexpected packet format.
at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
at System.Net.PooledStream.EndWrite(IAsyncResult asyncResult)
at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
I am not concerned about the error, I know what the issue is, I just want to be able to capture this exception in my failure callback function.
Any ideas?
LogEvent.Exception is the Exception shipped with your call to (for example) logger.Error(myException) - not the exception thrown by failure to write to Elastic Search.
The exception you're trying to catch doesn't look to be exposed by the sink as it just passes the LogEvent to FailureCallback and not exception that caused the failure.
Here's what it could look like were the exception exposed.
you can use:
StreamWriter writer = File.CreateText(...);
Serilog.Debugging.SelfLog.Enable(writer);
I'm trying to access server and mule version info in DW however I get the below message.
DWL looks like below. Please let me know if I'm making any mistakes below. I have tried both the syntaxes to access it.
%dw 1.0
%output application/json
---
{
errorType : payload.errorType,
env: server['host'],
host: server['host'],
ip: server['ip'],
javaVersion: server['javaVersion'],
javaVendor: server['javaVendor'],
osName: server['osName'],
osVersion: server['osVersion'],
muleVersion: mule.version,
clusterId: mule.clusterId,
nodeId: mule.nodeId
}
Message : Exception while executing:
env: server['host'],
^
There is no variable named 'server'.
Payload : {correlationId=046b6c7f-0b8a-43b9-b35d-6489e6daee91, message=This is the test message to test structured log, errorType=ERROR, applicationName=common wrappers - logging wrapper}
Payload Type : java.util.HashMap
Element : /wrapper-logger/processors/1 # common-wrappers:wrapper-logger.xml:16 (Transform Message)
Element XML : <dw:transform-message doc:name="Transform Message" metadata:id="38c29630-7d7c-48fc-a692-2407d0105cab">
<dw:input-payload doc:sample="sample_data\list_HashMap.dwl"></dw:input-payload>
<dw:set-payload>%dw 1.0%output application/json---{errorType : payload.errorType,env: server['host'],host: server['host'],ip: server['ip'],javaVersion: server['javaVersion'],javaVendor: server['javaVendor'],osName: server['osName'],osVersion: server['osVersion'],muleVersion: mule.version,clusterId: mule.clusterId,nodeId: mule.nodeId,applicationName : payload.applicationName,correlationId: payload.correlationId,correlationSequence: "To be decided",correlationGroupSize: 5,timeZone: server.timeZone,timeStamp: server.dateTime,muleFlow: "get-user-record",stackTrace: "A complete Stack Trace",message: payload.message}</dw:set-payload>
</dw:transform-message>
--------------------------------------------------------------------------------
Root Exception stack trace:
com.mulesoft.weave.mule.exception.WeaveExecutionException: Exception while executing:
env: server['host'],
^
There is no variable named 'server'.
at com.mulesoft.weave.mule.exception.WeaveExecutionException$.apply(WeaveExecutionException.scala:10)
You can define a Global function to get the server details and call it from dataweave.
<configuration doc:name="Configuration">
<expression-language>
<import class = "org.mule.util.NetworkUtils"/>
<import class="java.lang.System" />
<global-functions>
def getServerDetails() {
String ip = NetworkUtils.getLocalHost().getHostAddress();
String name = NetworkUtils.getLocalHost().getHostName();
String osName = System.getProperty("os.name");
String osVersion = System.getProperty("os.version");
String javaVersion = System.getProperty("java.version");
String javaVendor = System.getProperty("java.vendor");
return [ip, name, osName, osVersion, javaVersion, javaVendor];
}
</global-functions>
</expression-language>
</configuration>
Calling from dataweave
{
ip: getServerDetails()[0],
host: getServerDetails()[1],
osName: getServerDetails()[2],
osVersion: getServerDetails()[3],
javaVersion: getServerDetails()[4],
javaVendor: getServerDetails()[5]
}
I am writing web-api 2 OWIN-selfhosted console app( And i have one dll-library with ApiControllers and one dll with DataAccess types). I've added web-api tracing.
public class dobStartUp
{
public void Configuration(IAppBuilder app)
{
var config = new HttpConfiguration();
config.Services.Replace(typeof(IAssembliesResolver),new dobAssembliesResolver());
var container = new UnityContainer();
container.RegisterType<IdobRDBRepository, dobRDBRepository>(new TransientLifetimeManager());
container.RegisterType<IResourcesContentRepository, AS3ContentRepository>(new TransientLifetimeManager());
config.EnableSystemDiagnosticsTracing();
SystemDiagnosticsTraceWriter traceWriter = config.EnableSystemDiagnosticsTracing();
traceWriter.IsVerbose = false;
traceWriter.MinimumLevel = TraceLevel.Info;
config.DependencyResolver = new UnityDependencyResolver(container);
config.MapHttpAttributeRoutes();
app.UseWebApi(config);
}
}
class Program
{
static void Main(string[] args)
{
string baseAdress = "http://localhost:9001/";
using(Microsoft.Owin.Hosting.WebApp.Start<dobStartUp>(url: baseAdress))
{
Console.WriteLine("Owin web-app host started");
Console.Read();
}
}
}
When i try to call my service via browser or client (VLC player or WinAmp) for streamcontent - everything goes right at first look. But when I look throuh trace records, I can find that every trace records goes twice.
dobiji.WebApi.SimpleHost.vshost.exe Information: 0 : Request, Method=GET, Url=http://localhost:9001/resources/buf/2, Message='http://localhost:9001/resources/buf/2'
dobiji.WebApi.SimpleHost.vshost.exe Information: 0 : Request, Method=GET, Url=http://localhost:9001/resources/buf/2, Message='http://localhost:9001/resources/buf/2'
dobiji.WebApi.SimpleHost.vshost.exe Information: 0 : Message='Resources', Operation=DefaultHttpControllerSelector.SelectController
dobiji.WebApi.SimpleHost.vshost.exe Information: 0 : Message='Resources', Operation=DefaultHttpControllerSelector.SelectController
'dobiji.WebApi.SimpleHost.vshost.exe' (CLR v4.0.30319: dobiji.WebApi.SimpleHost.vshost.exe): Loaded 'D:\Projects\dobiji\sources\v2\dobiji.WebApi.SimpleHost\bin\Release\MySql.Data.Entity.EF6.dll'. Cannot find or open the PDB file.
'dobiji.WebApi.SimpleHost.vshost.exe' (CLR v4.0.30319: dobiji.WebApi.SimpleHost.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\MySql.Data\6.8.3.0__c5687fc88969c44d\MySql.Data.dll'. Cannot find or open the PDB file.
dobiji.WebApi.SimpleHost.vshost.exe Information: 0 : Message='dobiji.WebApi.ResourcesController', Operation=DefaultHttpControllerActivator.Create
dobiji.WebApi.SimpleHost.vshost.exe Information: 0 : Message='dobiji.WebApi.ResourcesController', Operation=DefaultHttpControllerActivator.Create
dobiji.WebApi.SimpleHost.vshost.exe Information: 0 : Message='dobiji.WebApi.ResourcesController', Operation=HttpControllerDescriptor.CreateController
dobiji.WebApi.SimpleHost.vshost.exe Information: 0 : Message='dobiji.WebApi.ResourcesController', Operation=HttpControllerDescriptor.CreateController
dobiji.WebApi.SimpleHost.vshost.exe Information: 0 : Message='Selected action 'GetResourceById_buffered(Int32 id)'', Operation=ApiControllerActionSelector.SelectAction
dobiji.WebApi.SimpleHost.vshost.exe Information: 0 : Message='Selected action 'GetResourceById_buffered(Int32 id)'', Operation=ApiControllerActionSelector.SelectAction
dobiji.WebApi.SimpleHost.vshost.exe Information: 0 : Message='Parameter 'id' bound to the value '2'', Operation=ModelBinderParameterBinding.ExecuteBindingAsync
dobiji.WebApi.SimpleHost.vshost.exe Information: 0 : Message='Parameter 'id' bound to the value '2'', Operation=ModelBinderParameterBinding.ExecuteBindingAsync
Now I have only 2 ApiControllers with several methods. On every method from client tracing goes same way - dublicate trace records.
I have not found any multi "registrations" in my code. Where it may be the reason of it?
Within our community server site, when I navigate to the UserList.aspx page, I get the following error every time: User Not Found, The user you requested cannot be found.
When I check the event log, I see asp.net warnings as follows:
Event Type: Warning
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1309
Date: 4/17/2013
Time: 9:39:43 AM
User: N/A
Computer: SV3369
Description:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 4/17/2013 9:39:43 AM
Event time (UTC): 4/17/2013 2:39:43 PM
Event ID: f121eb3cd0a847b2a53972a09f802235
Event sequence: 11116
Event occurrence: 1072
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/8022/ROOT-1-130105941980617500
Trust level: Full
Application Virtual Path: /
Application Path: C:\Inetpub\wwwroot\wisdomresearch.org\wwwroot\
Machine name: SV3369
Process information:
Process ID: 4148
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE
Exception information:
Exception type: CSException
Exception message: User Username not found in membership store does not exist.
Request information:
Request URL: http://wisdomresearch.org/themes/basic/Arete/UserList.aspx?interest=European+History
Request path: /themes/basic/Arete/UserList.aspx
User host address: 173.199.116.83
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE
Thread information:
Thread ID: 8
Thread account name: NT AUTHORITY\NETWORK SERVICE
Is impersonating: False
Stack trace: at CommunityServer.Users.AddMembershipDataToUser(UserSet users)
at CommunityServer.Users.GetUsers(UserQuery query, Boolean cacheable)
at Arete.Common.GetGlobalUsersTable()
at PageBase.GetUsersTableFromCache()
at Themes_basic_Arete_userlist.BindUsers()
at Themes_basic_Arete_userlist.ExecuteSearch()
at Themes_basic_Arete_userlist.Page_Load()
at System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp, Object o)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Also, I've seen this post, but I'm unsure of what I need to do if this is my problem.
First of all, I'm not familiar with community server site, although I used ASP.Net Membership extensively.
According to the SO link in your question, the problem is users are missing in cs_Users table (or might be other table).
1 - You need to find those orphaned rows. Something like this -
SELECT * FROM aspnet_Users WHERE UserId NOT IN (SELECT UserId FROM cs_Users)
2 - Then you either need to delete them or do something.