none
This collection already contains an address with scheme net.tcp but I just have one tcp endpoint defined RRS feed

  • Question

  • Could some one please help. Below is my app.config configuration. In this I declare only one net.tcp and one mex. Also, I enabled multipleSiteBindingsEnabled just for good measure. Doesn't matter what I do I still receive the following message when attempting to browse the service: "This collection already contains an address with scheme net.tcp". Any hint would be appreciated.

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>

      <system.web>
        <compilation debug="true" />
      </system.web>
      <!-- When deploying the service library project, the content of the config file must be added to the host's 
      app.config file. System.Configuration does not support config files for libraries. -->
      <system.serviceModel>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true">      
        </serviceHostingEnvironment>

        <services>      
          <service name="WCFTEST.Test"
                   behaviorConfiguration="WCFTESTTestBehavior">
            <!-- This endpoint is exposed at the base address provided by host: net.tcp://localhost/servicemodelsamples/service.svc  -->
            <endpoint address="" binding="netTcpBinding" bindingConfiguration="PortSharingBinding"
              contract="WCFTEST.ITest" />

            <!-- the mex endpoint is explosed at net.tcp://localhost/servicemodelsamples/service.svc/mex -->
            <endpoint address="mex"
                      binding="mexTcpBinding"
                      contract="IMetadataExchange" />        
            <host>
              <baseAddresses>
                <add baseAddress="net.tcp://127.0.0.1/WCFTEST" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <bindings>
          <netTcpBinding>
            <binding name="PortSharingBinding" portSharingEnabled="true">
              <security mode="None" />
            </binding>
          </netTcpBinding>
        </bindings>

        <!--For debugging purposes set the includeExceptionDetailInFaults attribute to true-->
        <behaviors>
          <serviceBehaviors>
            <behavior name="WCFTESTTestBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="False" />
            </behavior>
          </serviceBehaviors>
        </behaviors>

      </system.serviceModel>

    </configuration>

    Friday, January 21, 2011 12:36 PM

All replies

  • For IIS hosting you don;t specify your own base addresses - they are given by the URI of the .svc file. In your case i guess you have net.tcp set up as an allowed protocol in your site. The default site binding for net.tcp is on port 808 so therefore you already have a base address of 

     

    net.tcp://localhost:808/<vdir>/service.svc


    Richard Blewett, thinktecture - http://www.dotnetconsult.co.uk/weblog2
    Twitter: richardblewett
    Friday, January 21, 2011 1:31 PM
    Moderator
  • Hi Richard

     

    Could you please assist. I have read almost every post made on the web ;)

    I just can't seem to get this binding working. I have changed my address port to 8000, add it as a binding in IIS 7 added a inbound rule in windows firewall and when I try to ref or browse the service I still receive this error message....  The service is compiled with .NET 4 and IIS is configured accordingly 

    Could you please take a look at the following config code and point out what I am doing wrong?

    To my knowledge the code should make 2 endpoints both of them tcp, one is the Test contract endpoint with no security enabled connecting at port 8000.

    The second is the mex, same port but different contract for the meta data....  

     

     

    <?xml version="1.0" encoding="utf-8" ?>

    <configuration>

     

      <system.web>

        <compilation debug="true" />

      </system.web>

      <!-- When deploying the service library project, the content of the config file must be added to the host's 

      app.config file. System.Configuration does not support config files for libraries. -->

      <system.serviceModel>

        <serviceHostingEnvironment multipleSiteBindingsEnabled="true">

          <baseAddressPrefixFilters>

            <add prefix="net.tcp://localhost:8000/WCFServiceTest/"/>

          </baseAddressPrefixFilters>

        </serviceHostingEnvironment>

     

        <services>      

          <service name="WCFTEST.Test"

                   behaviorConfiguration="WCFTESTTestBehavior">

            <!-- This endpoint is exposed at the base address provided by host: net.tcp://localhost/servicemodelsamples/service.svc  -->

            <endpoint address="WCFTEST.Test.svc"

                      binding="netTcpBinding" 

                      bindingConfiguration="PortSharingBinding" 

                      name ="TestEnd"

                      listenUri=""

                      contract="WCFTEST.ITest" />

     

            <!-- the mex endpoint is explosed at net.tcp://localhost/servicemodelsamples/service.svc/mex -->        

            <endpoint address="WCFTEST.Test.svc"  

                      binding="mexTcpBinding"

                      contract="IMetadataExchange"      

                      name ="MexTCP"

                      listenUri=""/>  

     

            <host>

              <baseAddresses>

                <add baseAddress="net.tcp://localhost:8000/WCFServiceTest/" />            

              </baseAddresses>

            </host>        

          </service>

        </services>

        <bindings>

          <netTcpBinding>

            <binding name="PortSharingBinding" portSharingEnabled="true">

              <security mode="None" />

            </binding>

          </netTcpBinding>

        </bindings>

     

        <!--For debugging purposes set the includeExceptionDetailInFaults attribute to true-->

        <behaviors>

          <serviceBehaviors>

            <behavior name="WCFTESTTestBehavior">

              <serviceMetadata httpGetEnabled="false" />

              <serviceDebug includeExceptionDetailInFaults="False" />

            </behavior>

          </serviceBehaviors>

        </behaviors>

     

      </system.serviceModel>

     

    </configuration>


     

    Monday, January 24, 2011 2:07 PM
  • As I said before - you do not specify base addresses when IIS hosting - the base address is determined automatically from the address of the .svc file. So if you have created a binding in the IIS configuration for your site for net.tcp on port 8000 and allowed net.tcp as a protocol for you application (say MyApp). Then the base address of your service (assuming the service is in service.svc) is

    net.tcp://localhost:8000/myapp/service.svc

    In your endpoint make the address an empty string


    Richard Blewett, thinktecture - http://www.dotnetconsult.co.uk/weblog2
    Twitter: richardblewett
    Monday, January 24, 2011 2:16 PM
    Moderator
  • I removed the base address from the config and made the endpoints empty strings, but, now when I publish the project there no svc file....
    Monday, January 24, 2011 2:40 PM
  • Do you have a .svc file in your project?
    Richard Blewett, thinktecture - http://www.dotnetconsult.co.uk/weblog2
    Twitter: richardblewett
    Monday, January 24, 2011 2:46 PM
    Moderator
  • No, I thought it to be a file the publisher added only if the config settings were correct... I suppose, no?
    Monday, January 24, 2011 2:50 PM
  • no the .svc file identifies which class implements the service in your WCF service and acts as the physical endpoint. You can also map to a logical .svc file if you are using .NET 4

    http://msdn.microsoft.com/en-us/library/ee816902.aspx


    Richard Blewett, thinktecture - http://www.dotnetconsult.co.uk/weblog2
    Twitter: richardblewett
    Monday, January 24, 2011 3:21 PM
    Moderator
  • Still the same error message when I try to add the service as a ref. Could the fault be at the IIS configuration? I added 8000:* binding under the "default sites" and also net.tcp in the advanced settings on my application....
    Tuesday, January 25, 2011 7:53 AM
  • normally net.tcp is bound to port 808 on IIS7 with non-HTTP activation enabled. Did you remove the 808 binding and add the 8000 one?

    then, as you say, you need to add net.tcp as an enabled protocol in the advanced settings of your application. 

    Once you have done that you can use net.tcp to access the service by using the .svc file (physical or virtual as explained above) as the address (this is in fact the base address but commonly is also used as the endpoint address by leaving the endpoint address blank)

     


    Richard Blewett, thinktecture - http://www.dotnetconsult.co.uk/weblog2
    Twitter: richardblewett
    • Proposed as answer by Will.Rogers Tuesday, January 25, 2011 2:38 PM
    Tuesday, January 25, 2011 9:16 AM
    Moderator
  • Okay, I made some progress. "A binding instance has already been associated to listen URI 'net.tcp://" message. Could this be because the transaction endpoint and mex endpoint share the same port? 
    Tuesday, January 25, 2011 9:29 AM
  • Looks to me like you have two bindings in the site config for net.tcp - check the bindings as there is one by default for port 808
    Richard Blewett, thinktecture - http://www.dotnetconsult.co.uk/weblog2
    Twitter: richardblewett
    Tuesday, January 25, 2011 9:36 AM
    Moderator
  • I got something working, I changed the mex from tcp to http, but for this to work I needed to define the two base addresses. I removed the default binding of 808 and replaced it with 8000. What is the difference between adding a application under "default web sites" and creating your own web site configured as a tcp site?
    Tuesday, January 25, 2011 10:01 AM
  • A site defines the top level routing that IIS does based on DNS name and port. A site has bindings detailing what protocols are allowed and what ports they use. Applications then sit on the site enabling or otherwise the protocols allowed via the site bindings

    If you use the default website then all applications that sit underneath it share the same default ports and you may end up conflicting with another application's requirements

    If you use your own site then you have more to manage but you achieve a greater degree of isolation - but the site bindings must uniquely allow IIS to route the traffic to the site (there should be no ambiguity between it and say the default site)


    Richard Blewett, thinktecture - http://www.dotnetconsult.co.uk/weblog2
    Twitter: richardblewett
    Tuesday, January 25, 2011 11:51 AM
    Moderator
  • Thanks for the help. I managed to publish WCF service and tested the net.tcp endpoint settings with a win32 application but when I try to access the service via silverlight 4 application nothing. The app connect without any exception submit the request to the service, without any exceptions not even in the system event viewer.

    My first thought was that it was a client access policy issue, but after trying both with the xml file and code still no joy. The client configuration endpoint points to the correct uri and security settings are none. 

    Any suggestions?

    Tuesday, January 25, 2011 2:02 PM