简体   繁体   English

使用.NET SDK向Amazon Web Services Kinesis发布错误

[英]Error posting to Amazon Web Services Kinesis with .NET SDK

I was hoping one of you could help me with the use of AWS Kinesis. 我希望你们中的一个可以帮助我使用AWS Kinesis。 I have been pouring over the documentation and I am still unable to post a "blob" of data to a Kinesis stream. 我一直在浏览文档,但仍然无法将大量数据发布到Kinesis流中。

In the API the standard POST request is as follows. 在API中,标准POST请求如下。

POST / HTTP/1.1
Host: kinesis.<region>.<domain>
x-amz-Date: <Date>
Authorization: AWS4-HMAC-SHA256 Credential=<Credential>, SignedHeaders=contenttype;
date;host;user-agent;x-amz-date;x-amz-target;x-amzn-requestid, Signature=<Signature>
User-Agent: <UserAgentString>
Content-Type: application/x-amz-json-1.1
Content-Length: <PayloadSizeBytes>
Connection: Keep-Alive
X-Amz-Target: Kinesis_20131202.PutRecord
{
"StreamName": "exampleStreamName",
"Data": "XzxkYXRhPl8x",
"PartitionKey": "partitionKey"
}

Using "Postman" a google chrome app to make Http requests and filling in the appropriate information for the above fields I cannot for the life of me figure out how to make a successful data post to a stream. 使用Google Chrome应用程序“邮递员”发出Http请求,并为上述字段填写适当的信息,我一生都无法弄清楚如何在数据流中成功发布数据。 I was unable to do this successfully so i went on to do use the .NET SDK for visual studio. 我无法成功完成此操作,因此我继续使用Visual Studio的.NET SDK。

I made a quick command line c# console application I am still having some issues. 我做了一个快速命令行C#控制台应用程序,但仍然遇到一些问题。

My code: http://pastebin.com/cyJeC0vU 我的代码: http : //pastebin.com/cyJeC0vU

The error message, System.Xml.XmlException was unhandled , appears on line 61 of the code: http://pastebin.com/HEG7DmMw 错误消息System.Xml.XmlException未处理 ,出现在代码的第61行: http : //pastebin.com/HEG7DmMw

Has anyone had a successful experience using AWS Kinesis. 有没有人有过使用AWS Kinesis的成功经验。 I would love to pick your brain / repay you somehow for a bit of tutoring. 我很想打动您的大脑/以某种方式偿还您的费用,以便进行一些辅导。

Thanks again for all of your help! 再次感谢您的所有帮助!

The error you're getting indicates that the response from the service was not able to be parsed. 您收到的错误表明该服务的响应无法解析。 There is a clue in that the SDK switched from the JSON parser to the XML parser because the response looked like XML. 有一个线索是,SDK从JSON解析器切换到XML解析器,因为响应看起来像XML。 This usually indicates that you are behind a proxy which requires authentication, and the proxy is giving you an HTML error message. 这通常表明您位于需要身份验证的代理后面,并且该代理正在为您提供HTML错误消息。

You can verify this by firing up a protocol analyzer like Fiddler and watching the request traffic. 您可以通过启动诸如Fiddler之类的协议分析器并观察请求流量来验证这一点。 If your proxy requires credentials, here is some documentation about using the AWS SDK for .NET with proxies: 如果您的代理服务器需要凭证,则以下是有关将AWS SDK for .NET与代理一起使用的一些文档:

Configuring Credentials for Your AWS SDK for .NET Application 为适用于.NET应用程序的AWS开发工具包配置凭证

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM