none
Geting Error while wcf Hosting on iis under current website. RRS feed

  • Question

  • currently website is hosted on IIS6 and running fine, now requirement to create the wcf service under that website, i have created sample wcf  service when i started to browse it through following error!! kindly help me to solve the issue.

    This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection.

    Below Service Model iam using for wcf service which is include into current website web.config file. is there anything went wrong in below file?

     <system.serviceModel>

        <serviceHostingEnvironment>
         <baseAddressPrefixFilters>
           <add prefix="http://example.com/Service1.svc"/>
           <add prefix="http://www.example.com/Service1.svc/" />
        </baseAddressPrefixFilters>
      </serviceHostingEnvironment>


        <behaviors>
          <serviceBehaviors>
            <behavior name="SultanQaboos.Service1Behavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>



        <services>
          <service behaviorConfiguration="SultanQaboos.Service1Behavior"
            name="SultanQaboos.Service1">
            <endpoint address="" binding="wsHttpBinding" contract="SultanQaboos.IService1">

            </endpoint>
            <endpoint address="" binding="mexHttpBinding" contract="IMetadataExchange" />
              <host>
                <baseAddresses>
                  <add baseAddress="http://www.example.com/Service1.svc/" />
                </baseAddresses>
                </host>

          </service>

        </services>

      </system.serviceModel>

                                             
    • Edited by Mir Hassan Sunday, June 23, 2013 3:21 PM
    Sunday, June 23, 2013 3:02 PM

Answers

All replies

  • Firstly, try removing the

    <endpoint address="" binding="mexHttpBinding" contract="IMetadataExchange" />

    This is not required if the serviceMetadata tag is included.  Aslo, the address="" will conflict with your other endpoint.  Some WCF service designers like to host the metadata at a different location, for example address="meta".  Most designers like the metadata to be at the same location which is easily achieved with the behavior

    <serviceMetadata httpGetEnabled="true" />
    Cheers,
    Jeff

    Jeff

    Sunday, June 23, 2013 9:56 PM
  • Scnerio: I have one website running through multiple domains and below Host Header mentioned In IIS 6.

    http://www.examples.ae
    http://examples.ae
    http://eg.a
    http://www.eg.ae
    http://examples.com
    http://www.examples.com

    Now I have created one simple wcf service and put my files under the same webisite but it through the error when i browse my wcf web service through any of host header name like http://www.examples.ae/Service1.svc

    Error Detail: This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection.

    Below Service Model i am using for wcf service which is include into current website web.config file.kindly let me know why my web service or give me one real Configuration for same solution.

        <system.serviceModel>

        <serviceHostingEnvironment>
         <baseAddressPrefixFilters>
           <add prefix="http://www.examples.ae" />
           <add prefix="http://examples.ae" />
           <add prefix="http://eg.ae" />
           <add prefix="http://www.eg.ae" />
            <add prefix="http://examples.com" />
             <add prefix="http://www.examples.com" />  
        </baseAddressPrefixFilters>
      </serviceHostingEnvironment>

        <behaviors>
          <serviceBehaviors>
            <behavior name="SultanQaboos.Service1Behavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>

        <services>
          <service behaviorConfiguration="SultanQaboos.Service1Behavior"
            name="SultanQaboos.Service1">
            <endpoint address="http://www.exampleas.ae/Service1.svc" binding="wsHttpBinding" contract="SultanQaboos.IService1" />
            <endpoint address="http://examples.ae/Service1.svc" binding="wsHttpBinding" contract="SultanQaboos.IService1" />
             <endpoint address="http://www.examples.com/Service1.svc" binding="wsHttpBinding" contract="SultanQaboos.IService1" />
            <endpoint address="http://examples.com/Service1.svc" binding="wsHttpBinding" contract="SultanQaboos.IService1" />
            <endpoint address="http://www.eg.ae/Service1.svc" binding="wsHttpBinding" contract="SultanQaboos.IService1" />
            <endpoint address="http://eg.ae/Service1.svc" binding="wsHttpBinding" contract="SultanQaboos.IService1" />


                </service>
        </services>

      </system.serviceModel>

                                 
    Monday, June 24, 2013 5:50 AM
  • Hi,

    Please try the workarounds here to check if they help and please check if you have set multipleSiteBindingsEnabled="true".

    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, June 24, 2013 8:58 AM
    Moderator