I installed .NET SDK and in Visual Studio, selected New Project -> AWS -> Storage and Content Delivery -> AWS S3 Sample. Given below is my code.
using (client = Amazon.AWSClientFactory.CreateAmazonS3Client())
{
ListBucketsResponse response = client.ListBuckets();
}
My app.config has 3 values:
<add key="AWSAccessKey" value="xxxx"/>
<add key="AWSSecretKey" value="xxxxxxxx"/>
<add key="AWSRegion" value="us-east-1"/>
I get following exception at the statement:
ListBucketsResponse response = client.ListBuckets();
Exception
The request signature we calculated does not match the signature you provided. Check your key and signing method.
Inner Exception
The remote server returned an error: (403) Forbidden.
Please help.
Not sure if you figured this out yet, but I can confirm that your code is working 100% when I substitute my credentials instead.
If you are sure your credentials are correct, then make sure you have the newest .net sdk installed and try again - just tried it myself with version 2.0.15.1 available here:
http://sdk-for-net.amazonwebservices.com/latest/AWSToolsAndSDKForNet.msi
and it works as expected.
Related
I have created a web api method to Speech to text using Google Speech library. It is working fine when I execute using the visual studio. After hosting the application on IIS, I am getting below error when the api method is called
Method:Status(StatusCode=Unauthenticated, Detail="Getting metadata from plugin failed with error: Exception occurred in metadata credentials plugin.")
Error at line with code:
var speechResponse = speech.Recognize(SpeechConfig,
RecognitionAudio.FromFile(fileToProcess));*
And on another system, I have configured the GOOGLE_APPLICATION_CREDENTIALS env avariable with service account json, but I am getting below error
The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials.
Do you also have compact framework sdk installed for visual studio? if try adding
< NoStdLib > False< / NoStdLib >
in your *.csproj file. This would force VS to use the std mscorlib.dll instead of compact one.
Check if the date and time on your system are correct (should be with 60 seconds of actual time)
I have a problem when try to connect to MS CRM v9
I used this code to connect:
Uri organizationUri = new Uri(OrgUrl);
AuthenticationCredentials authCredentials = new AuthenticationCredentials();
authCredentials.ClientCredentials.UserName.UserName = UserName;
authCredentials.ClientCredentials.UserName.Password = Password;
OrganizationServiceProxy organizationProxy = new OrganizationServiceProxy(organizationUri, null, authCredentials.ClientCredentials, null);
organizationProxy.EnableProxyTypes();`
var _service = organizationProxy;
This is the Exception message
HResult=-2146233079 Message=Metadata contains a reference that
cannot be resolved:
'https://myOrg.api.crm4.dynamics.com/XRMServices/2011/Organization.svc?wsdl&sdkversion=9'.
InnerException:
HResult=-2146233079
Message=The underlying connection was closed: An unexpected error occurred on a send.
InnerException:
HResult=-2146232800
Message=Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
InnerException:
ErrorCode=10054
HResult=-2147467259
Message=An existing connection was forcibly closed by the remote host
Did anyone face this problem before. PS: this code is running before in the same project
It looks like you need to update your SDK references to the new 9.0 SDK references. There isn't a single download any more for the SDK, instead you have to use NuGet (https://blogs.msdn.microsoft.com/crm/2017/11/01/whats-new-for-customer-engagement-developer-documentation-in-version-9-0/)
No more monolithic SDK download
Probably the greatest single change is that we are no longer providing a single download package for all the documentation, tools and sample code. Going forward, instead of shipping a single package with everything in it, we will offer an a-la-carte approach so that you can download the individual things as you need them.
Get the assemblies and tools you need. SDK assemblies and tools will be distributed only via NuGet. We will provide a script that will allow you to download the assemblies and tools from NuGet. See Where to find the NuGet SDK packages and Download tools from NuGet.
Self-serve offline content generation. The new learn.microsoft.com site will allow you to download a PDF for any of our content areas so that you can read and search the documentation while offline.
Sample code availability. All our sample code will be available on msdn.microsoft.com or on GitHub. The code.msdn.microsoft.com site is designed for sample code and provides a good experience as well as providing us better metrics on usage.
Download only the pieces you need. Various assets we have included in the download package will be available as individual downloads. This way, if one of the assets needs to be updated we can just update it without releasing the entire SDK package.
https://www.nuget.org/profiles/crmsdk has a list of all the SDK DLLs you might need. Specifically https://www.nuget.org/packages/Microsoft.CrmSdk.XrmTooling.CoreAssembly/ includes the Connector which is what I think you actually need.
You can add it to your project using the following command in your NuGet console
Install-Package Microsoft.CrmSdk.XrmTooling.CoreAssembly -Version 9.0.0.7
If you don't need a specific version you can just use
Install-Package Microsoft.CrmSdk.XrmTooling.CoreAssembly
I generally use CrmServiceClient in the Xrm.Tooling.Connector namespace, with a connection string.
var svc = new CrmServiceClient(connectionString);
Please note that CrmServiceClient has a boolean property called IsReady, which is a good way to check if it's in a proper state.
Here are example connection strings for the various environment types. These are hardcoded examples, but you can also add them to the App.Config as shown in my answer here.
CRM 2016 and Dynamics 365 online:
var connectionString = "Url=https://dev26.crm.dynamics.com; Username=user#dev26.onmicrosoft.com; Password=Pass; AuthType=Office365";
On-premise with integrated security:
var connectionString="Url=http://myserver/AdventureWorksCycle;";
On-premise with credentials:
var connectionString="Url=http://myserver/AdventureWorksCycle; Domain=mydomain; Username=administrator; Password=password; AuthType=AD;";
On-premise IFD before CRM 2016:
var connectionString="Url=https://contoso.litware.com; Username=someone#litware.com; Password=password; AuthType=IFD;";
On-premise IFD for CRM 2016 and later (v8.0+)
var connectionString="ServiceUri=https://contoso.litware.com/contoso; Domain=contoso; Username=contoso\administrator; Password=password; AuthType=IFD; LoginPrompt=Never;";`
I have a server that utilizes AWS SES to send notification emails, but I keep recieving the following message:
An unhandled exception of type 'Amazon.Runtime.AmazonServiceException'
occurred in AWSSDK.dll
Additional information: Unable to find credentials
I have a credentials file fully accessible by the server's user and I use the following to tell the AWS SDK where the file is located and the profile name:
AWSConfigs.AWSProfileName = "example-user";
AWSConfigs.AWSProfilesLocation = Environment.CurrentDirectory + "/example-dir/credentials";
..however crashes at the following line with the error message:
AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(REGION);
I checked out this answer on Amazon.Runtime.AmazonServiceException: Unable to find credentials which suggests that profiles should be in the application's configuration file, like so:
<appSettings>
<add key="AWSProfilesLocation" value="C:\awsfile\credentials" />
<add key="AWSRegion" value="us-east-1" />
</appSettings>
...this results in the exact same error.
What am I doing wrong? The AWSConfigs.* code has been working for around six months now without issue, this started happening when my project took a hiatus and I restored it from its Git repository. I cannot remember which version of Visual Studio I used before but I'm currently using 2015 (update 3).
I did however get this to work by adding the credentials as system environment variables, but this isn't a permanent solution for security reasons.
If I download earlier commits, build them and run them, I get the exact same error. I'm thinking this is either something to do with the version of Visual Studio I'm using, but can't think of any reasons why this could be.
The AWS SDK and .NET versions have always been the same so it shouldn't be incompatibility (2.3.55.2 for the AWS SDK and .NET 4.6.1).
If you are running applications on an Amazon EC2 instance and those applications require AWS credentials, the best-practice advice is:
Never put credentials in your code
Assign an IAM Role to the instance and the SDK will automatically use those credentials
Even when you're running an application on a non-EC2 instance, avoid putting credentials in code. Instead, put them in environment variables or configuration files.
See: Configuring AWS Credentials for .Net applications
I'm trying to upgrade to RavenDB 2.0 (build 2230) from build 960. I've restored the DB to the new version, but I'm getting an error when trying to create my indexes.
This is the line of code:
IndexCreation.CreateIndexes(typeof(DataAccessFactory).Assembly, documentStore);
And this is the error:
A first chance exception of type 'System.InvalidOperationException'
occurred in Raven.Client.Lightweight-3.5.dll
{"The remote server returned an error: (403) Forbidden."}
I'm using the same authorization line, as the previous version, in the app config file:
<add key="Raven/Authorization/Windows/RequiredUsers" value="server\PrestoDatabaseUser"/>
Note, it works correctly if this is set to all, but I don't want to do that.
<add key="Raven/AnonymousAccess" value="Get"/>
Note, I also gave PrestoDatabaseUser full access to the Data folder.
Does RavenDB 2.0 work differently? Is there something new to do, or am I missing something?
The only other change I made, in the config file, was from this:
<add key="Raven/DataDir" value="~\Database\System"/>
To this:
<add key="Raven/DataDir" value="~\Data"/>
RavenDB 2.0 has strongly security measures.
This is no longer relevant:
<add key="Raven/Authorization/Windows/RequiredUsers" value="server\PrestoDatabaseUser"/>
You need to configure those from the studio, see: http://ravendb.net/docs/server/authentication
I get an error when I try to connect to WCF service :
"Error creating the Web Proxy specified in the
'system.net/defaultProxy' configuration section."
I'm using framework 2.0 and Visual Studio 2005.
My web.config content is :
<system.net>
<defaultProxy>
<proxy usesystemdefault="true"/>
</defaultProxy>
</system.net>
My computer has installed:
Microsoft .NET Framework 2.0 Service Pack 2
Microsoft .NET Framework 2.0 SDK-ENU
( Framework 1.1 , 3,5 and 4.0 )
I tested :
My current working folder is in a localdriver ,and this folder isn't shared.
I set all permisions to this folder to my current user.
Repair Framework 2.0 ( Windows add and remove programs )
Other people in development team doesn't have problem when connect to WCF.
If I create blank project and try to connect , I get the same error.
Also If I Try to create new blank WCF service and try to connect , I get the same error.
I CAN show service when I type service url in a browser ( no connection problems )
Firewall and Antivirus software in my local machine is disabled.
If I try to connect to service via svcutil.exe "http://server:8080/Service.svc?wsdl" , I get the same error. ( Can't create web/proxy... )
I suspect that error description doesen't represent the real problem.
What are the main causes of this error?
It's possible that missing some additional software?
Thanks for all in advance!
I'm getting crazy with this error!
Not sure if this helps. I faced a similar issue and the problem was due to invalid default Proxy configuration at following location
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG/machine.config
It would depend on the framework you are working against.
Hope this helps