IIS hosted WCF service and accessing the servicebus

Beantwortet IIS hosted WCF service and accessing the servicebus

  • Friday, January 20, 2012 3:35 PM
     
      Has Code

    I've asked this already on stackoverflow with no luck: http://stackoverflow.com/questions/8897020/exposing-local-wcf-service-through-azure-appfabric-relay-service

    -------------------------------------------

    I've been following the Pluralsight demo from the new course:http://www.pluralsight-training.net/microsoft/Courses/TableOfContents?courseName=azure-sb in the section "Demo: Configure an Existing Service to use the Relay Service".

    All is well until I come to the point where I expect to see the services listed in appfabric at https://MyURL.servicebus.windows.net/

    Nothing shows up.

    I've went through everything a number of times, checking and rechecking my settings.

    My service is hosted in IIS, it's running, the web.config has it set to listen to the above URL, I've configured Auto-start, and it refreshed when I changed the setting, so it should be listening, but yet no services show up.

    I had this issue: http://blogs.digitaldeposit.net/saravana/post/2011/06/23/AppFabric-Service-Bus-netpipe-needs-to-be-specified-error.aspx

    and I've followed the fix for that so that no errors show up in the event log.

    Anything else I could be missing or that I could check?

    How is my hosted service "listening" and how does it "publish" its service data onto the service bus? is there something I can sniff to see how/why it is failing?

    I am aware the network setup is important and I need specific ports need to be open etc, our IT guys assure me the correct ports are open and the machine should be able to get through them.

    I have also enabled auto-start on the Site and the service.

    UpdateI have managed to self host the service programatically which publishes the sevrice into the Azure feed - this proves the network ports are all open, but I still want to have it hosted in IIS.

    Many thanks in advance!

    Here is my web.config with secure personal details removed (apologies, it's a biggie!)

        <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.web>
        <compilation debug="true" targetFramework="4.0" />
      </system.web>
      <system.serviceModel>
        <bindings>
          <webHttpRelayBinding>
            <binding name="anonymous">
              <security relayClientAuthenticationType="None" />
            </binding>
          </webHttpRelayBinding>
          <netTcpRelayBinding>
            <binding name="Hybrid">
              <security relayClientAuthenticationType="None" />
            </binding>
          </netTcpRelayBinding>
        </bindings>
        <behaviors>
          <endpointBehaviors>
            <behavior name="MyBehaviour">
              <serviceRegistrySettings discoveryMode="Public" displayName="My Service" />
              <transportClientEndpointBehavior credentialType="SharedSecret">
                <clientCredentials>
                  <sharedSecret issuerName="Listener" issuerSecret="MYSECRET"></sharedSecret>
                </clientCredentials>
              </transportClientEndpointBehavior>
            </behavior>
            <behavior name="MyBehaviourRest">
              <serviceRegistrySettings discoveryMode="Public" displayName="My Rest Service" />
              <transportClientEndpointBehavior credentialType="SharedSecret">
                <clientCredentials>
                  <sharedSecret issuerName="Listener" issuerSecret="MYSECRET"></sharedSecret>
                </clientCredentials>
              </transportClientEndpointBehavior>
              <webHttp />
    
    </behavior>
          </endpointBehaviors>
          <serviceBehaviors>
            <behavior>
              <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
              <serviceMetadata httpGetEnabled="true" />
              <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <services>
          <service name="MyService">
            <endpoint address="" binding="basicHttpBinding" contract="My.NameSpace.IContract"></endpoint>
            <endpoint address="Rest" binding="webHttpBinding" contract="My.NameSpace.IContract"></endpoint>
            <endpoint address="https://MYURL.servicebus.windows.net/MyService" behaviorConfiguration="MyBehaviour" binding="basicHttpBinding" contract="My.NameSpace.IContract"></endpoint>
            <endpoint address="sb://MYURL.servicebus.windows.net/MyServiceNet" behaviorConfiguration="MyBehaviour" binding="netTcpRelayBinding" contract="My.NameSpace.IContract"></endpoint>
            <endpoint address="https://MYURL.servicebus.windows.net/MyServiceRest" behaviorConfiguration="MyBehaviourRest" binding="webHttpRelayBinding" bindingConfiguration="anonymous" contract="My.NameSpace.IContract"></endpoint>
          </service>
        </services>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
        <extensions>
          <!-- In this extension section we are introducing all known service bus extensions. User can remove the ones they don't need. -->
          <behaviorExtensions>
            <add name="connectionStatusBehavior" type="Microsoft.ServiceBus.Configuration.ConnectionStatusElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            <add name="transportClientEndpointBehavior" type="Microsoft.ServiceBus.Configuration.TransportClientEndpointBehaviorElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            <add name="serviceRegistrySettings" type="Microsoft.ServiceBus.Configuration.ServiceRegistrySettingsElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
          </behaviorExtensions>
          <bindingElementExtensions>
            <add name="netMessagingTransport" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingTransportExtensionElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            <add name="tcpRelayTransport" type="Microsoft.ServiceBus.Configuration.TcpRelayTransportElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            <add name="httpRelayTransport" type="Microsoft.ServiceBus.Configuration.HttpRelayTransportElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            <add name="httpsRelayTransport" type="Microsoft.ServiceBus.Configuration.HttpsRelayTransportElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            <add name="onewayRelayTransport" type="Microsoft.ServiceBus.Configuration.RelayedOnewayTransportElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
          </bindingElementExtensions>
          <bindingExtensions>
            <add name="basicHttpRelayBinding" type="Microsoft.ServiceBus.Configuration.BasicHttpRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            <add name="webHttpRelayBinding" type="Microsoft.ServiceBus.Configuration.WebHttpRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            <add name="ws2007HttpRelayBinding" type="Microsoft.ServiceBus.Configuration.WS2007HttpRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            <add name="netTcpRelayBinding" type="Microsoft.ServiceBus.Configuration.NetTcpRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            <add name="netOnewayRelayBinding" type="Microsoft.ServiceBus.Configuration.NetOnewayRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            <add name="netEventRelayBinding" type="Microsoft.ServiceBus.Configuration.NetEventRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            <add name="netMessagingBinding" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingBindingCollectionElement, Microsoft.ServiceBus, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
          </bindingExtensions>
        </extensions>
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
            <directoryBrowse enabled="true" />
      </system.webServer>
    </configuration>
    

    • Edited by Oz_1 Friday, January 20, 2012 3:37 PM
    •  

All Replies

  • Monday, January 23, 2012 7:53 AM
    Moderator
     
     Answered

    Hi,

    Have you enabled service discovery? Please refer to http://msdn.microsoft.com/en-us/library/windowsazure/dd582704.aspx. If not, even if the service is running, it will not show up in the Service Bus Registry. In addition, which address do you use? Usually we use a sub address of our Service Bus namespace instead of root address. For example: https://MyURL.servicebus.windows.net/myservice/. I would like to suggest you to check if Windows Server AppFabric has been configured properly. Try to access the service’s local address (http://localhost/...) and see if it works fine. This is essentially “manually” starting the service. If this works fine, then the issue is probably in AppFabric auto starting configuration, and you can also post a thread on http://social.msdn.microsoft.com/Forums/en-US/dublin/threads.

     

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
  • Monday, January 23, 2012 10:52 AM
     
      Has Code

    Thanks Ming.

    Well, in my web.config that I copied into my original post, I certainly have the following: 

    <serviceRegistrySettings discoveryMode="Public" displayName="My Service" />
    

    ...which is what I believe you are referring to?

    Also, on my endpoints I do use subdomain as follows:

     <endpoint address="https://MYURL.servicebus.windows.net/<strong>MyService</strong>" behaviorConfiguration="MyBehaviour" binding="basicHttpBinding" contract="My.NameSpace.IContract"></endpoint>
     <endpoint address="sb://MYURL.servicebus.windows.net/<strong>MyServiceNet</strong>" behaviorConfiguration="MyBehaviour" binding="netTcpRelayBinding" contract="My.NameSpace.IContract"></endpoint>
      <endpoint address="https://MYURL.servicebus.windows.net/<strong>MyServiceRest</strong>" behaviorConfiguration="MyBehaviourRest" binding="webHttpRelayBinding" bindingConfiguration="anonymous" contract="My.NameSpace.IContract"></endpoint>
    

     The service works perfectly when hosted locally and calling it using WCFTestClient.

    thanks, I'll try the other forum.

     


    • Edited by Oz_1 Monday, January 23, 2012 10:55 AM
    •  
  • Wednesday, January 25, 2012 6:42 AM
    Moderator
     
     

    Hi,

      >> thanks, I'll try the other forum.

    You can also find more instructions as well as a sample on http://archive.msdn.microsoft.com/ServiceBusDublinIIS/Release/ProjectReleases.aspx?ReleaseId=4336.

     

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework