[英]AWS Turk NotifyWorker method not working with .NET SDK when switching from Sandbox to Production
I created a small app in .NET C# that allows me to send emails to workers using their Worker ID. 我在.NET C#中创建了一个小型应用程序,该应用程序使我可以使用工作人员ID向工作人员发送电子邮件。 I sent an email to my own personal Worker ID and it worked fine when I have my service endpoint set as https://mechanicalturk.sandbox.amazonaws.com?Service=AWSMechanicalTurkRequester in the App.config file.
我已将电子邮件发送到我自己的个人Worker ID,当我在App.config文件中将服务端点设置为https://mechanicalturk.sandbox.amazonaws.com?Service=AWSMechanicalTurkRequester时,它可以正常工作。
However when I switch the service endpoint to https://mechanicalturk.amazonaws.com?Service=AWSMechanicalTurkRequester the email never arrives. 但是,当我将服务端点切换到https://mechanicalturk.amazonaws.com?Service=AWSMechanicalTurkRequester时 ,电子邮件永远不会到达。
It also doesnt seem like the NotifyWorker method has any response method in the SDK like it does in the normal URI request in the form of an XML response, so its getting pretty infuriating to debug. 似乎NotifyWorker方法在SDK中没有像XML响应形式的普通URI请求中那样具有任何响应方法,因此调试起来非常恼人。
Does anyone have any ideas why when I switch the service endpoint, the message never arrives? 有谁知道为什么当我切换服务端点时消息永远不会到达?
(Requested Edit) Here is the code that runs the main function: (请求编辑)这是运行主要功能的代码:
public class WorkerArgs
{
public string FileName { get; set; }
public bool Mass { get; set; }
public string WorkerID { get; set; }
public string Message { get; set; }
public string Subject { get; set; }
public WorkerArgs(string fileName, bool mass, string message, string subject)
{
this.FileName = fileName;
this.Mass = mass;
this.Message = message;
this.Subject = subject;
}
public WorkerArgs(bool mass, string workerId, string message, string subject)
{
this.Mass = mass;
this.WorkerID = workerId;
this.Message = message;
this.Subject = subject;
}
}
private void bwRun_DoWork(object sender, DoWorkEventArgs e)
{
WorkerArgs args = (WorkerArgs)e.Argument;
if (args.Mass)
{
List<string> workers = CSVProcessor.GetUniqueWorkers(args.FileName);
for (int i = 0; i < workers.Count(); i += 100) {
MessageSender.SendMessage(args.Subject, args.Message, workers.Skip(i).Take(100).ToList());
}
}
else
{
MessageSender.SendMessage(args.Subject, args.Message,new List<string>(new string[] { args.WorkerID }));
}
}
class CSVProcessor
{
public static List<string> GetUniqueWorkers(string fileName)
{
//WorkerCollection workers = new WorkerCollection();
List<string> workers = new List<string>();
using (TextFieldParser tfp = new TextFieldParser(fileName))
{
tfp.Delimiters = new string[] { "," };
tfp.ReadFields();
while (!tfp.EndOfData)
{
string[] values = tfp.ReadFields();
if (!String.IsNullOrWhiteSpace(values[21])) { workers.Add(values[15]); } //{ workers.addUniqueWorker(values[15]); }
}
}
return workers.Distinct().ToList();
}
}
class MessageSender
{
public static void SendMessage(string subject, string messageText, List<string> workerIDs) {
SimpleClient client = new SimpleClient();
client.NotifyWorkers(subject, messageText, workerIDs);
}
}
Figured out the issue. 找出问题。 Amazon Turks only allows you to NotifyWorkers for workers who have completed HITs for you.
Amazon Turks仅允许您为已为您完成HIT的工作人员通知人。 As the people I have been messaging have not completed HITs for me and the only person that was successful was my own worker ID in the sandbox (which is where I had completed some of my own HITs), that is the reason of the lack of messages arriving.
由于我一直在与之聊天的人还没有为我完成HIT,并且唯一成功的人是我自己的工号(在我的沙箱中,这是我完成一些HIT的位置),这就是缺少消息到达。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.