영업: 1-800-867-1380

 locked
Echo Service Sample error

    질문

  • Hi,

    This is newbie question –

     

    Echo Service sample from Windows Azure AppFabric SDK V1.0 is giving following exception at "host.Open();" line -

     

    System.ServiceModel.EndpointNotFoundException was unhandled

      Message=Could not connect to net.tcp://mynamespace.servicebus.appfabriclabs.com:9351/EchoService/. The connection attempt lasted for a time span of 00:00:21.0362032. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 208.68.143.50:9351.

      Source=System.ServiceModel

     

    Below is the code.

      

    Any help would be greatly appreciated.

      

    Thanks.

      

    Config file -

    <system.serviceModel><services><service name="Microsoft.ServiceBus.Samples.EchoService"><endpoint contract="Microsoft.ServiceBus.Samples.IEchoContract" binding="netTcpRelayBinding"/></service></services></system.serviceModel>

      

    Console app file code -

      

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using System.ServiceModel;

    using Microsoft.ServiceBus;

    using System.ServiceModel.Description;

    using Microsoft.ServiceBus.Description;

     

     

    namespace Microsoft.ServiceBus.Samples

    {

        [ServiceContract(Name = "IEchoContract", Namespace = "http://samples.microsoft.com/ServiceModel/Relay/")]

        public interface IEchoContract

        {

            [OperationContract]

            string Echo(string text);

        }

     

        public interface IEchoChannel : IEchoContract, IClientChannel { }

     

        [ServiceBehavior(Name = "EchoService", Namespace = "http://samples.microsoft.com/ServiceModel/Relay/")]

        class EchoService : IEchoContract

        {

            public string Echo(string text)

            {

                Console.WriteLine("Echoing: {0}", text);

                return text;

            }

        }

     

        class Program

        {

            static void Main(string[] args)

            {

                       Console.Write("Your Service Namespace: ");

                string serviceNamespace = Console.ReadLine();

                Console.Write("Your Issuer Name: ");

                string issuerName = Console.ReadLine();

                Console.Write("Your Issuer Secret: ");

                string issuerSecret = Console.ReadLine();

     

     

                TransportClientEndpointBehavior sharedSecretServiceBusCredential = new TransportClientEndpointBehavior();

                sharedSecretServiceBusCredential.CredentialType = TransportClientCredentialType.SharedSecret;

     

                sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerName = issuerName;

                sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerSecret = issuerSecret;

     

                Uri address = ServiceBusEnvironment.CreateServiceUri("sb", serviceNamespace, "EchoService");

     

                ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.AutoDetect;

     

                ServiceHost host = new ServiceHost(typeof(EchoService), address);

     

                IEndpointBehavior serviceRegistrySettings = new ServiceRegistrySettings(DiscoveryType.Public);

     

                foreach (ServiceEndpoint endpoint in host.Description.Endpoints)

                {

                    endpoint.Behaviors.Add(serviceRegistrySettings);

                    endpoint.Behaviors.Add(sharedSecretServiceBusCredential);

                }

     

                host.Open();

                Console.WriteLine("Service address: " + address);

                Console.WriteLine("Press [Enter] to exit");

                Console.ReadLine();

                host.Close();

     

            }

        }

    }

     


    2011년 5월 23일 월요일 오전 12:31

모든 응답

  • Hi,

     

    We need a bit more of information to diagnose this issue:

     

    • Can you post the full stack trace?
    • What version of the SDK do you have V1.0 or V2.0?
    • What version of the Samples do you have V1.0 or V2.0?
    • Are you using a Labs Namespace? Can you make sure you can hit the service registry?

    http://YOURNAMESPACE.servicebus.appfabriclabs.com/

    Thanks,

    Manuel


    Manuel Ocampo
    2011년 5월 23일 월요일 오후 10:21
  • It's working now. Thanks for the pointers Manuel. Issue is resolved when I had added a reference of Microsoft.ServiceBus in the project to from SDK V1.0. If you add a reference from SDK 2.0, it fails because namespace is different -

    SDK1.0: http://azureaspnetpocnamespace.servicebus.windows.net/

    SDK2.0:http://azureaspnetpocnamespace.servicebus.appfabriclabs.com/


    KS1111
    2011년 5월 24일 화요일 오전 6:12
  • HI,

    I am referring ServiceBus from V1.6 SDK. But am getting the following Error While connecting to serviceBus as client.

     

    ---------------------------
    Error
    ---------------------------
    System.ServiceModel.EndpointNotFoundException: Could not connect to net.tcp://csslabsservice.servicebus.windows.net:9354/. The connection attempt lasted for a time span of 00:00:21.0480000. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 111.221.80.244:9354.  ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 111.221.80.244:9354

       at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)

       at System.ServiceModel.Channels.SocketConnectionInitiator.ConnectAsyncResult.OnConnect(IAsyncResult result)

       --- End of inner exception stack trace ---



    Server stack trace:

       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)

       at System.ServiceModel.Channels.CommunicationObject.OpenAsyncResult.End(IAsyncResult result)

       at System.ServiceModel.Channels.CommunicationObject.EndOpen(IAsyncResult result)

       at Microsoft.ServiceBus.Messaging.Channels.SharedChannel`1.GetInstanceAsyncResult.<GetAsyncSteps>b__4(GetInstanceAsyncResult thisPtr, IAsyncResult r)

       at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)



    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__11(RequestAsyncResult thisPtr, IAsyncResult r)

       at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)



    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.StepCallback(IAsyncResult result)



    Exception rethrown at [2]:

       at Microsoft.ServiceBus.Messaging.Channels.ServiceBusOutputChannel.Send(Message message, TimeSpan timeout)

       at System.ServiceModel.Dispatcher.OutputChannelBinder.Send(Message message, TimeSpan timeout)

       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)

       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)



    Exception rethrown at [3]:

       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

       at ServiceBusPubSub.Contracts.IEventNotification`1.OnEventOccurred(TLog value)

       at Client.MainWindow.btnPublishEvent_Click(Object sender, RoutedEventArgs e) in D:\WORKSPACE.SL051760\CSSLABS\AzureCloud\wcf&servicebus\ServiceBusQueues\Client\MainWindow.xaml.cs:line 51


    R Balaji
    2011년 12월 15일 목요일 오전 9:25