none
can WAS host multiple queue endpoints? RRS feed

  • Question

  • I have a WCF service with multiple endpoints using different binding (queues, tcp and http). Can WAS host this type of service. I have seen that the svc file need to match the name of the queue, but what if there are more then one queue endpoint? or if I have other endpoints that are not queue endpoints?
    Friday, March 27, 2009 2:41 PM

Answers

  • Finaly found that this can not be done, not without making 2 svc files to the same service, or having both queue endpoints using the same physical queue.

    Saturday, December 12, 2009 2:41 AM

All replies

  • Hi Mike,

     

    ·          Here’s a sample that is created using WAS hosted WCF service that hosts endpoints using namedpipes, http, tcp and msmq.

    ·          Here a client is also included.

    ·          To set it up first you’ll have to create a private msmq queue.

    ·          Here it is named ScottsQueue but you can name it whatever.

    ·          You’ll have to change your config to reflect the machine you’re hosting on and the queue name. 

    ·          You’ll have to change this in the config (both client and service):

     

                     <appSettings>

                     <add key="ScottsQueueName" value="GandalfTheGrey.redmond.corp.microsoft.com\private$\ScottsQueue" />

                     </appSettings>

     

    <endpoint address="net.msmq://GandalfTheGrey/private/ScottsQueue"

                     binding="netMsmqBinding"

                     bindingConfiguration="msmqBinding"

                     name="ScottsEndpointMSMQ"

              contract="TestComponent.IBlah" />

     

    ·          To set up your site for non-http protocols first you’ll need to go to ‘Turn Windows Features On or Off’, find MS .NET Framework 3.0 and enable WCF non-HttpActivation

    ·          Then you need to enable your site.

    ·          There’s some scripts to do that but here the applicationHost.config file is modified manually to do that.

                <site name="Default Web Site" id="1" serverAutoStart="true">

                                    <application path="/WasTestingService" enabledProtocols="http,net.pipe,net.tcp,net.msmq">

                      <virtualDirectory path="/" physicalPath="E:\Indigo\Samples\MySamples\WasTestingService" />

                                    </application>

                      <bindings>     

                        <binding protocol="http" bindingInformation="*:80:" />

                        <binding protocol="https" bindingInformation="*:443:" />

                        <binding protocol="net.tcp" bindingInformation="808:*" />

                        <binding protocol="net.pipe" bindingInformation="*" />

                        <binding protocol="net.msmq" bindingInformation="localhost" />

                      <binding protocol="net.msmq" bindingInformation="GandalfTheGrey" />

                        <binding protocol="msmq.formatname" bindingInformation="localhost" />

                    </bindings>

                </site>

     

    ·          In addition, for the msmq binding you’ll note that I have two listings, one for a machine name and another for the localhost.  If you do this you’ll need to add this to your service web.config. (To choose which one you want to host.)

     

        <system.serviceModel>

          <serviceHostingEnvironment >

            <baseAddressPrefixFilters>

              <add prefix="net.msmq://GandalfTheGrey"/>

            </baseAddressPrefixFilters>

          </serviceHostingEnvironment>

     

    Hope this helps.

     

    Regards

    Gayathri

    Friday, April 3, 2009 2:24 PM
  • Thank you very much for responding with a very nice example.

    I have a service with 2 queue endpoints, can I host this service with WAS... I read that the svc file must match the queue name... but my service is listening to two queues, so how do I name my svc file?
    Thursday, July 30, 2009 10:54 PM
  • Finaly found that this can not be done, not without making 2 svc files to the same service, or having both queue endpoints using the same physical queue.

    Saturday, December 12, 2009 2:41 AM
  • :D. I have done this WAS + 1 service(.svc file) + two msmq queue.

    You need to create two private queues
    private/MyApp/Kew1.svc
    private/MyApp/Kew2.svc

    Create your web sevice Service1.svc in your web app "MyApp"

    In you web config add the following:

    <configuration> <configSections> </configSections> <system.web> <urlMappings> <clear/> <add url="~/Kew1.svc" mappedUrl="~/Service1.svc"/> <add url="~/Kew2.svc" mappedUrl="~/Service1.svc"/> </urlMappings> </system.web> <system.serviceModel> <serviceHostingEnvironment> <serviceActivations> <add service="MyNamespace.MyserviceClass" relativeAddress="~/Kew1.svc" /> <add service="MyNamespace.MyserviceClass" relativeAddress="~/Kew2.svc" /> </serviceActivations> </serviceHostingEnvironment> <services> <service name="MyNamespace.MyserviceClass"> <host> <baseAddresses> <add baseAddress="http://localhost/MyApp/Service1.svc"/> </baseAddresses> </host> <endpoint address="net.msmq://localhost/private/MyApp/Kew1.svc" binding="netMsmqBinding" contract="MyNamespace.IDoStuff"> <identity> <dns value="localhost"/> </identity> </endpoint> <endpoint address="net.msmq://localhost/private/MyApp/Kew2.svc" binding="netMsmqBinding" contract="MyNamespace.IDoOtherStuff"> <identity> <dns value="localhost"/> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> </system.serviceModel> </configuration>

     


    You now have a single service listening to two queues using net.msmq binding and WAS.

    Thank you very much

    [Engage Smug Mode]

    • Proposed as answer by JonPen Friday, June 22, 2012 1:48 PM
    Friday, June 22, 2012 1:48 PM