'No service is hosted at the specified address.' when calling Azure web role hosted WCF service with service bus endpoints.

Answered 'No service is hosted at the specified address.' when calling Azure web role hosted WCF service with service bus endpoints.

  • 2011년 1월 15일 토요일 오후 5:29
     
     

    Hello!

    I have an Azure application which consists of one web role and one worker role and I am trying to use the Service Bus to enable the worker role to send messages to the web role. In my web role, I have created a WCF service and given it a service bus endpoint - then in my worker role, I have added a service reference and set the endpoint correctly. However, whenever the worker role tries to call any methods on my service via its proxy, I get the exception 'No service is hosted at the specified address.'.

    I know my service bus credentials etc are correct and that my account is setup correctly because if I host the WCF service in a test web application (via cassini) and add a service reference to it in a windows forms test harness, the communication works perfectly and I can see the traffic going out to the service bus using Fiddler web debugger. The issue just seems to be when it is hosted in an Azure web role. Could this be something to do with Azure using IIS so I would have to perform some kind of 'warm up' in order for my service to start listening for requests?

    I have attached my client and server ServiceModel sections from the configs in case that helps:

    Server config (web role):

     

    <system.serviceModel>

        <behaviors>

          <serviceBehaviors>

            <behavior name="ServiceBehaviour">

              <serviceMetadata httpsGetEnabled="false" />

            </behavior>

          </serviceBehaviors>

          <endpointBehaviors>

            <behavior name="sharedSecretClientCredentials">

              <transportClientEndpointBehavior credentialType="SharedSecret">

                <clientCredentials>

                  <sharedSecret issuerName="owner" issuerSecret="<<key>>" />

                </clientCredentials>

              </transportClientEndpointBehavior>

            </behavior>

          </endpointBehaviors>

        </behaviors>

        <services>

          <service name="MessagingService.MessagingService" behaviorConfiguration="ServiceBehaviour">

            <endpoint address="https://<<project>>.servicebus.windows.net/" name="RelayEndpoint" binding="ws2007HttpRelayBinding" behaviorConfiguration="sharedSecretClientCredentials" contract="MessagingService.IMessagingService" />

          </service>

        </services>

      </system.serviceModel>

     

     

    Client config (worker role):

     

    <system.serviceModel>

        <bindings>

          <ws2007HttpRelayBinding>

            <binding name="RelayEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00"

              receiveTimeout="00:10:00" sendTimeout="00:01:00" maxBufferPoolSize="524288"

              maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8"

              useDefaultWebProxy="true" allowCookies="false">

              <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"

                maxBytesPerRead="4096" maxNameTableCharCount="16384" />

              <reliableSession ordered="true" inactivityTimeout="00:10:00"

                enabled="false" />

              <security mode="Transport" relayClientAuthenticationType="RelayAccessToken">

                <transport proxyCredentialType="None" />

                <message establishSecurityContext="true" clientCredentialType="Windows"

                  negotiateServiceCredential="true" />

              </security>

            </binding>

          </ws2007HttpRelayBinding>

        </bindings>

        <behaviors>

          <endpointBehaviors>

            <behavior name="sharedSecretClientCredentials">

              <transportClientEndpointBehavior credentialType="SharedSecret">

                <clientCredentials>

                  <sharedSecret issuerName="owner" issuerSecret="<<key>>" />

                </clientCredentials>

              </transportClientEndpointBehavior>

            </behavior>

          </endpointBehaviors>

        </behaviors>

        <client>

          <endpoint address="https://<<project>>.servicebus.windows.net/"

            binding="ws2007HttpRelayBinding" bindingConfiguration="RelayEndpoint" behaviorConfiguration="sharedSecretClientCredentials"

            contract="MessagingService.IMessagingService" name="RelayEndpoint" />

        </client>

      </system.serviceModel>

     

     

    Thanks for your help

     

    Dan

모든 응답

  • 2011년 1월 29일 토요일 오후 3:29
     
     답변됨
    Your assumption is correct.  When you test locally your service has already been loaded into memory (warmedup if you will).  To get this to work you would need to have the service loaded on your instance.  The bad news is that you cant warm up the service in your windows azure instance.  One possible although hacky solution could be to create a vm role and install your wcf service on your vm.  Then your web role would be able call the wcf service through the .net service endpoint.