none
WCF Service using serviceActivations with multiple endpoints RRS feed

  • Question

  • I'm trying to set up a svc-less WCF service using serviceActivations that exposes multiple endpoints with different bindings. Here's the web.config serviceModel portion:

    <system.serviceModel>
      <behaviors>
        <serviceBehaviors>
          <behavior>
            <serviceMetadata httpGetEnabled="true"/>
          </behavior>
        </serviceBehaviors>
      </behaviors>
      <serviceHostingEnvironment multipleSiteBindingsEnabled="true" >
        <serviceActivations>
          <add service="ClassLibrary1.Class1" relativeAddress="Service.svc" />
        </serviceActivations>
      </serviceHostingEnvironment>
      <services>
        <service name="ClassLibrary1.Class1">
          <endpoint address="web" binding="webHttpBinding" contract="ClassLibrary1.IClass1" />
          <endpoint address="" binding="wsHttpBinding" contract="ClassLibrary1.IClass1" />
          <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        </service>
      </services>
    </system.serviceModel>

    With this config, the service only responds to the relative address specified in the serviceActivation config section: http://localhost/WebApplication1/Service.svc

    If I try to navigate to http://localhost/WebApplication1/Service.svc/web I get an ActionNotSupported error.

    I've seen a lot of posts on multiple endpoints WCF services, but not with one using serviceActivations.

    What am I doing wrong? Is it possible to expose 2 endpoints for a single WCF service using serviceActivations?

    Thursday, January 17, 2013 7:28 PM

Answers

  • Hi,

    After testing, you cannot browse the address of the endpoint from browser, this error occurs because the corresponding information of http://localhost/WebApplication1/Service.svc/web cannot be found.

    You can test if the service works as expected by consuming the service from a client, in addition, you need add a relative address for another binding(wsHttpBinding) too.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 21, 2013 3:30 AM
    Moderator

All replies

  • Hi,

    To narrow down the issue, please try if the two bindings will work if you do not use serviceActivations.

    And you have to place the web.config containing the configuration under the root of the virtual Application.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, January 18, 2013 11:52 AM
    Moderator
  • OK, tried it and it doesn't work either with a svc file... I have the exact same behavior. The service responds to the http://localhost/WebApplication1/Service.svc and returns an ActionNotSupported fault at http://localhost/WebApplication1/Service.svc/web.

    The web.config is under the root of the web application, it's a web application projet hosted in IIS.

    Friday, January 18, 2013 3:18 PM
  • Hi,

    After testing, you cannot browse the address of the endpoint from browser, this error occurs because the corresponding information of http://localhost/WebApplication1/Service.svc/web cannot be found.

    You can test if the service works as expected by consuming the service from a client, in addition, you need add a relative address for another binding(wsHttpBinding) too.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 21, 2013 3:30 AM
    Moderator
  • I know that this post is already a little old, but the true reason while he cannot access the his .../web endpoint is not because he didn't set the endpoint behavior?

    <behaviors>
    	<endpointBehaviors>
    		<behavior name="WebHttp">
    			<webHttp />
    		</behavior>
    	</endpointBehaviors>
    <endpoint address="web"
    		  binding="webHttpBinding"
    		  contract="ClassLibrary1.IClass1"
    		  behaviorConfiguration="WebHttp" />

    Saturday, December 21, 2013 12:01 AM