我正在尝试配置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有人能帮忙吗?
发布于 2014-04-09 04:23:08
我的猜测是,您正坐在HTTP代理(可能是防火墙)后面,它希望您在进入实际的Azure通知中心之前进行身份验证。您可能必须在Notification客户端API上为代理设置凭据--我不太确定如何做到这一点,但我希望文档能够指出正确的方向。
亨里克
发布于 2014-04-30 17:41:49
我认为亨里克是对的。
您必须在需要身份验证信息的代理服务器后面。
您可以添加以下代码..。
WebRequest.DefaultWebProxy = new WebProxy("http://proxyserveraddress:port");
WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials;然后您就可以通过API发送通知了。
我使用当前用户的凭据,但您可以创建自定义NetworkCredentials。
希望能帮上忙。
哈维尔
https://stackoverflow.com/questions/22835925
复制相似问题