I am using following binaries
NServiceBus.Core 5.0.0.0
NServiceBus.Host 6.0.0.0
NServiceBus.AmazonSQS 1.0.0.0
I am trying to configure endpoint as below
var transport = configuration.UseTransport();
configuration.EndpointName(“xxx”);
transport.ConnectionString(
@“Region=us-east-1;S3BucketForLargeMessages=xyz;S3KeyPrefix=‘’;”);
Also in app.config set access key and secret key as below as per link Configure SDK authentication with AWS - AWS SDK for .NET
App.config
<add key="AWSProfileName" value="default" />
<add key="AWSRegion" value="us-east-1" />
<add key="AWSProfilesLocation" value="C:\credentials.txt"/>
<add key="AWSAccessKey" value="xxxx" />
<add key="AWSSecretKey" value="xyz" />
I am getting below error after running
2018-06-05 23:33:12.745 ERROR NServiceBus.GenericHost Exception when starting endpoint.
Autofac.Core.DependencyResolutionException: An exception was thrown while executing a resolve operation. See the InnerException for details. ---> The environment variables AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN were not set with AWS credentials. (See inner exception for details.) ---> System.InvalidOperationException: The environment variables AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN were not set with AWS credentials.
at Amazon.Runtime.EnvironmentVariablesAWSCredentials.FetchCredentials()
at NServiceBus.AmazonSQS.AwsClientFactory.CreateCredentials(SqsConnectionConfiguration connectionConfiguration)
at NServiceBus.AmazonSQS.AwsClientFactory.CreateS3Client(SqsConnectionConfiguration connectionConfiguration)
at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p)
at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Autofac.Core.Activators.Reflection.AutowiringPropertyInjector.InjectProperties(IComponentContext context, Object instance, Boolean overrideSetValues)
at Autofac.Core.Registration.ComponentRegistration.RaiseActivating(IComponentContext context, IEnumerable`1 parameters, Object& instance)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
I am running this application from my local machine not EC2 instance. I have below specific questions
- In below link it is mentioned set environmental variables for access keys and secret key
Amazon SQS Transport • Particular Docs
Would I need to add environmental variables for those? What If I run this on EC2 instance? - Is my connection string correct? I want to keep S3KeyPrefix as empty.
- Can we not provide access key and secret key from code itself?