我已经设置了IOS应用程序,因此可以推送到Amazon Simple Notification Service。如果我在亚马逊内部手动操作的话。这可以在我的ISO设备上运行
我的问题是:如何将单个设备使用C#推送到Amazon Simple Notification Service?这样我就可以从C#代码发送推送。
我尝试下载:AWS工具(AWSToolsAndSDKForNet_sdk-3.3.309.0_ps-3.3.283.0_tk-1.14.3.3)。
我尝试使用AWS Samples(AWS控制台项目)创建一个新的Visuel Studio 2017
我的错误代码是:
WebException:无法解析远程名称: 'sdb.eu-central-1.amazonaws.com'
我尝试从childcat创建一个推送,并且有效。这是我来自childcat的代码:
Chilkat.Global glob = new Chilkat.Global();
bool successlicence = glob.UnlockBundle("Anything for 30-day trial");
if (successlicence != true)
{
Console.WriteLine(glob.LastErrorText);
return;
}
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Chilkat.Rest rest = new Chilkat.Rest();
// Connect to the Amazon AWS REST server.
// such as https://sns.us-west-2.amazonaws.com/
bool bTls = true;
int port = 443;
bool bAutoReconnect = true;
bool success = rest.Connect("sns.eu-central-1.amazonaws.com", port, bTls, bAutoReconnect);
// Provide AWS credentials for the REST call.
Chilkat.AuthAws authAws = new Chilkat.AuthAws();
authAws.AccessKey = "????";
authAws.SecretKey = "????????";
// the region should match our URL above..
authAws.Region = "eu-central-1";
authAws.ServiceName = "sns";
rest.SetAuthAws(authAws);
rest.AddQueryParam("Action", "Publish");
rest.AddQueryParam("TopicArn", "arn:aws:sns:eu-central-1:762332960199:TestSNSTopic");
// For subscribed email addresses, this is the subject of the email.
rest.AddQueryParam("Subject", "Test Message from Amazon SNS");
rest.AddQueryParam("Message", "This is a test message from Amazon SNS");
string responseXml = rest.FullRequestNoBody("GET", "/");
if (rest.LastMethodSuccess != true)
{
Console.WriteLine(rest.LastErrorText);
return;
}
// A successful response will have a status code equal to 200.
if (rest.ResponseStatusCode != 200)
{
Console.WriteLine("response status code = " + Convert.ToString(rest.ResponseStatusCode));
Console.WriteLine("response status text = " + rest.ResponseStatusText);
Console.WriteLine("response header: " + rest.ResponseHeader);
Console.WriteLine("response body: " + responseXml);
return;
}
// Examine the successful XML response.
Chilkat.Xml xml = new Chilkat.Xml();
xml.LoadXml(responseXml);
Console.WriteLine(xml.GetXml());
// To get the MessageId
Console.WriteLine("MessageId: " + xml.ChilkatPath("PublishResult|MessageId|*"));
有人可以帮助我吗?预先谢谢你。