Locked IIS hosted WCF service and accessing the servicebus

  • 23 มกราคม 2555 10:56
     
      มีโค้ด

    I've asked this already on stackoverflow with no luck: http://stackoverflow.com/questions/8897020/exposing-local-wcf-service-through-azure-appfabric-relay-service and here: http://social.msdn.microsoft.com/Forums/en-JM/windowsazureconnectivity/thread/ab4abf96-fd13-4aa3-9a65-85a9d805c14d - the admin there recommended this forum.

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

    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 athttps://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 itshould 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>
    

ตอบทั้งหมด

  • 24 มกราคม 2555 14:59
     
     
    anyone?!??
  • 24 มกราคม 2555 18:44
    ผู้ดูแล
     
     

    So basically you are trying to not self-host but use the service on IIS. I am trying to remember if the .svc file can be modified for this case or not. (Update: no it is handled differently).

    Thanks,


    If this answers your question, please use the "Answer" button to say so | Ben Cline

  • 25 มกราคม 2555 10:23
     
      มีโค้ด

    thanks Ben.

    I am trying to host the WCF Service in IIS on my local server and have it expose an endpoint on the Azure Service bus.

    My .svc file looks like this:

    <%@ ServiceHost Language="C#" Debug="true" Service="MyNameSpace.MyService" CodeBehind="MyService.svc.cs" %>
    

     

    I have not tried to modify it to use a different service host. I am not entirely sure what that actually means.

    None of the Azure service bus examples etc appear to require any modications to the .svc file in order to turn a normal (ie not listening to Service bus endpoint) IIS hosted WCF service into one that listen on the service bus.

     

  • 26 มกราคม 2555 5:41
    ผู้ดูแล
     
     

    Nevermind about modifying the .svc file.

    Here is another blog post that mentions how to do it. http://www.wadewegner.com/2010/05/host-wcf-services-in-iis-with-service-bus-endpoints/

    I looked at your config file and was wondering maybe you should provide an endpoint address for the localhost IIS endpoint.

    Thanks,

     


    If this answers your question, please use the "Answer" button to say so | Ben Cline
  • 26 มกราคม 2555 9:58
     
     

    thanks Ben, yeah, I've seen Wade's post, it's one of the first posts when you google this issue, it is one of the few posts by a blogger on the subject.

    The updated blog post he links to is the method I'm trying to follow using AppFabric auto start to warm up the service. From that post you can see it should be straight forward enough (though he doesn't mention the net.pipe issue or setting the app pool to autostart, startmode=alwaysrunning, and to use integrated pipeline mode)

    The address in the local endpoint does not help unfortunately.

     

     

  • 26 มกราคม 2555 15:04
    ผู้ดูแล
     
     

    Are you seeing anything in the event log?

    Thanks,


    If this answers your question, please use the "Answer" button to say so | Ben Cline
  • 26 มกราคม 2555 16:34
     
     

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

    Nope! :(

     

     

     

  • 27 เมษายน 2555 20:17
     
     
    I've gotten this to work in IIS7 if you're still having issues.  The thing I haven't seen listed here specifically is using service activations -- I don't think a .svc file will work.