0

我正在尝试在 Azure 通知中心配置 ios 推送通知。我知道我做的一切都是正确的,因为我以前做过,而且我有一个清单。但由于某种原因,它没有任何合乎逻辑的解释就失败了。我得到的错误是

The remote server returned an error: (407) Proxy Authentication Required..TrackingId:b12dc955-b24f-42f9-acc4-3440c4d60ab4,TimeStamp:03/04/2014 10:48

和 StackTrace

Exception rethrown at [0]: 
at Microsoft.ServiceBus.Common.ExceptionDispatcher.Throw(Exception exception)
at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
at Microsoft.ServiceBus.Common.AsyncResult`1.End(IAsyncResult asyncResult)
at Microsoft.ServiceBus.Messaging.ServiceBusResourceOperations.EndGetAll(IAsyncResult asyncResult, String& continuationToken)
at Microsoft.ServiceBus.NamespaceManager.EndGetRegistrationsByTag(IAsyncResult result)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at RD8MobileApp.Api.Services.PushNotificationService.<RegisterForNotifications>d__1.MoveNext() in c:\Development\TFS\RD8\MobileApp.Api\Services\PushNotificationService.cs:line 29

任何人都可以帮忙吗?

4

2 回答 2

1

我认为亨里克是对的。

您必须位于需要身份验证信息的代理服务器后面。

您可以添加以下代码...

WebRequest.DefaultWebProxy = new WebProxy("http://proxyserveraddress:port");
WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials;

然后您就可以通过 API 发送通知。

我使用当前用户的凭据,但您可以创建自定义 NetworkCredentials。

希望能帮助到你。

哈维尔

于 2014-04-30T17:41:49.723 回答
0

我的猜测是您坐在 HTTP 代理(可能是防火墙)后面,该代理希望您在进入实际的 Azure 通知中心之前进行身份验证。您可能必须在 Notification Hub 客户端 API 上设置代理的凭据——我不太确定如何执行此操作,但我希望文档可以为您指明正确的方向。

亨里克

于 2014-04-09T04:23:08.087 回答