2012-09-05 2 views
3

Azure ServiceBus API를 사용하여 서비스 버스에 게시했습니다. sb 프로토콜은 방화벽 뒤에서 작동하지 않습니다. 그래서 ServiceBusEnvironment.SystemConnectivity.Mode를 ConnectivityMode.Http로 설정했습니다. 이것은 인터넷에 직접 연결되어있는 한 계속 작동했습니다. http 프록시를 구성한 후에도 내 사무실에서이 작업을 수행 할 수 없습니다. ServiceBus API에 문제가 있습니까? 이것에 대한 당신의 도움을 감사하십시오.프록시 뒤에 http를 통해 Azure 서비스 버스에 게시

다음은 아래

public static void Initialize() 
    { 
     // Using Http to be friendly with outbound firewalls 
     ServiceBusEnvironment.SystemConnectivity.Mode = 
      ConnectivityMode.Http; 

     //InitializeQueue(); 
    } 


    // The name of your queue 
    public const string QueueName = "ordersqueue"; 

    public static NamespaceManager CreateNamespaceManager() 
    { 
     // Create the namespace manager which gives you access to 
     // management operations 
     var uri = ServiceBusEnvironment.CreateServiceUri(
      "sb", Namespace, String.Empty); 
     var tP = TokenProvider.CreateSharedSecretTokenProvider(
      IssuerName, IssuerKey); 
     return new NamespaceManager(uri, tP); 
    } 

    private static void InitializeQueue() 
    { 
     // Create the namespace manager which gives you access to 
     // management operations 
     var namespaceManager = CreateNamespaceManager(); 

     // Create the queue if it does not exist already 
     if (!namespaceManager.QueueExists(QueueName)) 
     { 
      namespaceManager.CreateQueue(QueueName); 
     } 

     // Get a client to the queue 
     var messagingFactory = MessagingFactory.Create(
      namespaceManager.Address, 
      namespaceManager.Settings.TokenProvider); 
     OrdersQueueClient = messagingFactory.CreateQueueClient(
      QueueName); 
    } 

내가 얻을 스택 추적입니다 .... 내가 사용하는 코드의 조각이다 ................... ............. .................................... ...........................

Microsoft.ServiceBus.Messaging.MessagingCommunicationException was unhandled 
    Message=Unable to connect to ServiceBus using HTTP connectivity mode 
    Source=Microsoft.ServiceBus 
    IsTransient=true 
    StackTrace: 
     at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageSender.EndSendCommand(IAsyncResult result) 
     at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageSender.OnEndSend(IAsyncResult result) 
     at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageSender.OnSend(TrackingContext trackingContext, IEnumerable`1 messages, TimeSpan timeout) 
     at Microsoft.ServiceBus.Messaging.MessageSender.Send(TrackingContext trackingContext, IEnumerable`1 messages, TimeSpan timeout) 
     at Microsoft.ServiceBus.Messaging.MessageSender.Send(BrokeredMessage message) 
     at Microsoft.ServiceBus.Messaging.QueueClient.Send(BrokeredMessage message) 
     at AzureServiceBusPublisher.QueueConnector.send(String arg) in C:\Users\prasanh\Documents\Visual Studio 2010\Projects\AzureServiceBusPublisher\AzureServiceBusPublisher\QueueConnector.cs:line 72 
     at AzureServiceBusPublisher.Program.sendMessagesToQueue() in C:\Users\prasanh\Documents\Visual Studio 2010\Projects\AzureServiceBusPublisher\AzureServiceBusPublisher\Program.cs:line 23 
     at AzureServiceBusPublisher.Program.Main(String[] args) in C:\Users\prasanh\Documents\Visual Studio 2010\Projects\AzureServiceBusPublisher\AzureServiceBusPublisher\Program.cs:line 13 
     at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) 
     at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) 
     at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
     at System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
     at System.Threading.ThreadHelper.ThreadStart() 
    InnerException: System.ServiceModel.CommunicationException 
     Message=Unable to connect to ServiceBus using HTTP connectivity mode 
     Source=Microsoft.ServiceBus 
     StackTrace: 
     Server stack trace: 
      at Microsoft.ServiceBus.WebStream..ctor(Uri factoryEndpointUri, String webSocketRole) 
      at Microsoft.ServiceBus.WebSocketConnection..ctor(Uri factoryEndpointUri, String webSocketRole, Int32 asyncReadBufferSize) 
      at Microsoft.ServiceBus.WebSocketOnewayConnectionInitiator.Connect(Uri uri, TimeSpan timeout) 
      at Microsoft.ServiceBus.WebSocketOnewayConnectionInitiator.BeginConnect(Uri uri, TimeSpan timeout, AsyncCallback callback, Object state) 
      at Microsoft.ServiceBus.Channels.BufferedConnectionInitiator.BeginConnect(Uri uri, TimeSpan timeout, AsyncCallback callback, Object state) 
      at Microsoft.ServiceBus.Channels.ConnectionPoolHelper.EstablishConnectionAsyncResult.OpenUsingNewConnection() 
      at Microsoft.ServiceBus.Channels.ConnectionPoolHelper.EstablishConnectionAsyncResult.Begin() 
      at Microsoft.ServiceBus.Channels.ConnectionPoolHelper.EstablishConnectionAsyncResult..ctor(ConnectionPoolHelper parent, TimeSpan timeout, AsyncCallback callback, Object state) 
      at Microsoft.ServiceBus.Channels.ConnectionPoolHelper.BeginEstablishConnection(TimeSpan timeout, AsyncCallback callback, Object state) 
      at Microsoft.ServiceBus.Channels.ClientFramingDuplexSessionChannel.OpenAsyncResult..ctor(ClientFramingDuplexSessionChannel duplexChannel, TimeSpan timeout, AsyncCallback callback, Object state) 
      at Microsoft.ServiceBus.Channels.ClientFramingDuplexSessionChannel.OnBeginOpen(TimeSpan timeout, AsyncCallback callback, Object state) 
      at Microsoft.ServiceBus.Channels.CommunicationObject.OpenAsyncResult..ctor(CommunicationObject communicationObject, TimeSpan timeout, AsyncCallback callback, Object state) 
      at Microsoft.ServiceBus.Channels.CommunicationObject.BeginOpen(TimeSpan timeout, AsyncCallback callback, Object state) 
      at Microsoft.ServiceBus.Channels.LayeredChannel`1.OnBeginOpen(TimeSpan timeout, AsyncCallback callback, Object state) 
      at Microsoft.ServiceBus.Channels.CommunicationObject.OpenAsyncResult..ctor(CommunicationObject communicationObject, TimeSpan timeout, AsyncCallback callback, Object state) 
      at Microsoft.ServiceBus.Channels.CommunicationObject.BeginOpen(TimeSpan timeout, AsyncCallback callback, Object state) 
      at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.OnBeginOpen(TimeSpan timeout, AsyncCallback callback, Object state) 
      at System.ServiceModel.Channels.CommunicationObject.OpenAsyncResult.InvokeOpen() 
      at System.ServiceModel.Channels.CommunicationObject.OpenAsyncResult..ctor(CommunicationObject communicationObject, TimeSpan timeout, AsyncCallback callback, Object state) 
      at System.ServiceModel.Channels.CommunicationObject.BeginOpen(TimeSpan timeout, AsyncCallback callback, Object state) 
      at Microsoft.ServiceBus.Messaging.Channels.SharedChannel`1.GetInstanceAsyncResult.<GetAsyncSteps>b__3(GetInstanceAsyncResult thisPtr, TimeSpan t, AsyncCallback c, Object s) 
      at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.EnumerateSteps(CurrentThreadType state) 
      at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.Start() 
     Exception rethrown at [0]: 
      at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
      at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.End(IAsyncResult asyncResult) 
      at Microsoft.ServiceBus.Messaging.Channels.SharedChannel`1.OnEndCreateInstance(IAsyncResult asyncResult) 
      at Microsoft.ServiceBus.Messaging.SingletonManager`1.EndGetInstance(IAsyncResult asyncResult) 
      at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.RequestAsyncResult.<GetAsyncSteps>b__f(RequestAsyncResult thisPtr, IAsyncResult r) 
      at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.EnumerateSteps(CurrentThreadType state) 
     Exception rethrown at [1]: 
      at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
      at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.End(IAsyncResult asyncResult) 
      at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.EndRequest(IAsyncResult result) 
      at Microsoft.ServiceBus.Messaging.Sbmp.SbmpTransactionalAsyncResult`1.<GetAsyncSteps>b__44(TIteratorAsyncResult thisPtr, IAsyncResult a) 
      at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.EnumerateSteps(CurrentThreadType state) 
     Exception rethrown at [2]: 
      at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
      at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.End(IAsyncResult asyncResult) 
      at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageSender.EndSendCommand(IAsyncResult result) 
     InnerException: System.ServiceModel.CommunicationException 
      Message=Unable to connect downstream 
      Source=Microsoft.ServiceBus 
      StackTrace: 
       at Microsoft.ServiceBus.WebStream.CreateDownStreamRequest(Uri endpointLocation) 
       at Microsoft.ServiceBus.WebStream.StartSession(Uri readEndpoint, Uri writeEndpoint) 
       at Microsoft.ServiceBus.WebStream..ctor(Uri factoryEndpointUri, String webSocketRole) 
      InnerException: System.Net.WebException 
       Message=The remote server returned an error: (403) Forbidden. 
       Source=System 
       StackTrace: 
         at System.Net.HttpWebRequest.GetResponse() 
         at Microsoft.ServiceBus.WebStream.CreateDownStreamRequest(Uri endpointLocation) 
       InnerException: 

답변

2

세부 예외는 무엇입니까?

제 경험상, 너무 많은 프록시는 HTTP 1.1을 기본 구성으로 지원하지 않습니다. 서비스 버스가 제대로 작동하려면 HTTP 1.1이 필요합니다. 이 외에

난 당신이 내가 윈도우 Azure 서비스 버스 팀에 SDE있어이 guide to troubleshoot connectivity to Service Bus

+0

"HTTP 연결 모드를 사용하여 ServiceBus에 연결할 수 없습니다."예외 체인에서 자세히 설명 된 예외가 발생해야합니다. "청크 인코딩 업로드는 HTTP/1.0 프로토콜에서 지원되지 않습니다." – DavideB

+0

감사합니다. "HTTP 연결 모드를 사용하여 ServiceBus에 연결할 수 없습니다"라는 오류 메시지가 나타납니다. 그러나 그 아래에는 오류가 없습니다. 대신 "원격 서버에서 오류를 반환했습니다 : (403) 금지"라는 오류 메시지가 나타납니다. 이 오류가 발생하는 이유는 무엇입니까? 나는 sb 프로토콜을 통해 연결하는 동안이 오류가 나타나지 않으며 둘 다 프록시없이 연결하는 동안이 오류가 발생하지 않습니다. – phebbar

+0

[문제 해결 가이드] (http://social.technet.microsoft.com/wiki/contents/articles/troubleshooting-connectivity-issues-in-the-windows-azure-appfabric-service-bus)의 모든 내용을 확인했다고 가정합니다. .aspx) : 브라우저를 통한 액세스, ping 테스트 및 그 밖의 모든 것이 프록시 뒤에서 괜찮습니까? 안내서의 4 절 (프록시 구성)이 유용 할 수 있습니다. IMO 프록시와 관련된 문제 일 수 있습니다. HTTP 403 오류가 다소 혼란 스러울지라도. 코드도 괜찮습니다. 그렇지 않으면 TCP를 통해 실패합니다. 따라서 네트워크 액세스는 추가 조사를위한 나머지 영역입니다. – DavideB

1

을 확인하는 것이 좋습니다. 게시 된 가이드를 시도하십시오.

또한 SDK 1.7에서 서비스 버스 메시징은 POST 청킹을 지원하는 HTTP 1.1 프록시에서만 작동한다는 점도 알아 두십시오. 우리는 이것에 대한 장기적인 솔루션을 개발하기 위해 노력하고 있으며, 곧 출시 될 SDK 1.8을 통해 Service Bus Relay가 POST 덩어리가 아닌 HTTPS를 사용하여 HTTP 1.0 프록시를 통해 이러한 프록시에서 작동 할 수 있습니다.

우리는 또한 특정 시스코 프록시 (및 다른 사람)가 시도되는 모든 IP 주소 연결에 이름 주소가 필요하다는 것을 알고 있습니다. 우리는이 문제에 대한 장기적인 해결책을 모색하고 있습니다.

+0

매일 40 %의 고객이 기본적으로 HTTP 1.1을 차단하는 방화벽을 보유하고있어 매일 직면하는 문제에 대해 알려 드리게되어 기쁩니다. – DavideB

+1

두 분 모두 고마워요. 내 프록시가 HTTP 1.1을 지원하는지 여부를 어떻게 알 수 있습니까? 프록시를 통해 작동하는 webex 공유가 있습니다.이 프록시는 HTTP 1.1 기능을 사용한다고 생각합니다. – phebbar

관련 문제