Web applications Web API:使用Google云消息发送通知

Web applications Web API:使用Google云消息发送通知,web-applications,google-cloud-messaging,asp.net-web-api,azure-mobile-services,Web Applications,Google Cloud Messaging,Asp.net Web Api,Azure Mobile Services,我正在尝试使用谷歌云消息向我的android客户端发送通知,但我收到以下错误: “服务”名称在当前上下文中不存在 我的代码: [HttpGet] [Route("api/loginuser")] public async Task<IHttpActionResult> LoginUser(string email, string password) { Dictionary<string, string> data = new Dictionary

我正在尝试使用谷歌云消息向我的android客户端发送通知,但我收到以下错误:

“服务”名称在当前上下文中不存在

我的代码:

[HttpGet]
[Route("api/loginuser")]
public async Task<IHttpActionResult> LoginUser(string email, string password)
{
            Dictionary<string, string> data = new Dictionary<string, string>()
            {
                { "message", "Welcome"}
            };

            GooglePushMessage message = new GooglePushMessage(data, TimeSpan.FromHours(1));
            try
            {
                //This is where I get the error
                var result = await Services.Push.SendAsync(message);
                Services.Log.Info(result.State.ToString());
            }
            catch (System.Exception ex)
            {
                Services.Log.Error(ex.Message, null, "Push.SendAsync Error");
            }

            return Ok("Healthy"});
}
[HttpGet]
[路由(“api/loginuser”)]
公共异步任务登录用户(字符串电子邮件、字符串密码)
{
字典数据=新字典()
{
{“信息”,“欢迎”}
};
GooglePushMessage消息=新的GooglePushMessage(数据,TimeSpan.FromHours(1));
尝试
{
//这就是我得到错误的地方
var result=await Services.Push.sendsync(消息);
Services.Log.Info(result.State.ToString());
}
catch(System.Exception-ex)
{
Services.Log.Error(例如,Message,null,“Push.sendsync Error”);
}
返回Ok(“健康”});
}

我已经正确地引用了所有需要的东西。我仍然收到此错误?

您使用的是普通Web API还是Azure移动服务?“服务”类型仅在移动服务上可用。