php - Microsoft Azure 通知错误 : 404 No service is hosted at the specified address

标签 php android azure push-notification google-cloud-messaging

社区早上好,

我有一个 Microsoft Azure 服务,我正在尝试使用它向 Android 移动设备发送通知。我按照 Microsoft Azure guys 提供的教程中的步骤进行操作当我运行以下代码来发送测试通知时,

$ message = '{"data": {"msg": "Hello from PHP!"}}'; 
$ notification = new Notification ("gcm", $ message); 
$ hub-> SendNotification ($ notification, ""); 

我收到此错误消息。

Error sending notificaiton: 404 
msg: 404 No service is hosted at the specified address .. 
TrackingID: e147f89a-8bad-4f73-a4c4-8f4194a728ed_G18, 
TimeStamp: 10/24/2014 2:16:15 PM 

有人知道为什么会发生这种情况吗?你知道如何解决吗?

我的印象是,可能是我的代码中存在错误,或者我在服务器上放置了错误的内容,因为它是 REST 服务,所以它应该适用于每个人。

不知道你们是否需要我的连接字符串或应用程序名称或其他内容 T_T

根据@efimovandr的建议,这里是HTTP调用请求

GET http://mer-extra.cloudapp.net/matches/mandarPush.php HTTP/1.1
Host: mer-extra.cloudapp.net
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,es;q=0.6,pt;q=0.4,th;q=0.2,gl;q=0.2
Cookie: CAKEPHP=t3foani8l7sineodcel5svplq5

响应是:

HTTP/1.1 200 OK
Date: Tue, 28 Oct 2014 14:33:02 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.3.10-1ubuntu3.13
Vary: Accept-Encoding
Content-Length: 2230
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8

希望这有帮助。谢谢!

最佳答案

您的问题可能与我的相同:

Azure push notification rest no service is hosted at the specified address

重要的是中心名称与命名空间名称不同,不像他们当前的教程所说的那样。 (微软告诉我他们会在他们的文档中编辑和更新此内容)。

其次,请确保您使用正确的 key (DefaultFullSharedAccessSignature)。这是他们在文档中出现的另一个错误。

关于php - Microsoft Azure 通知错误 : 404 No service is hosted at the specified address,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26550098/

相关文章:

php - 如何设置 PHPMD 规则属性?

javascript - ajax文件下载 : progress event, 进行下载

android - 有Android SDK到带有蜂窝的平板电脑吗?

azure - 使用 Redlocks 获取 Azure Redis 缓存上的锁

c# - Stimulsoft 导出仅包含正方形的 pdf

javascript - Laravel elixir "gulp watch"不监视 Javascript 更改

android - 为什么大多数人在retrofit中使用拦截器添加认证头?

android - 如何为星期几设置一个月中的某一天?

c# - 在android中访问azure中的机器人

php - 返回一个带有可变参数列表的方法作为 PHP 中的引用