none
This collection already contains an address with scheme http RRS feed

  • Question

  • Exception Details: System.ArgumentException: This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection.
    Parameter name: item

    Hello All I am getting the above error. This is something i cant understand as from everything i have read in book and online suggest that my below config should resolve this issue. Does anyone have any ideas as to what i can do here?


    <configuration>
      <system.serviceModel>
    	<serviceHostingEnvironment>
            <baseAddressPrefixFilters>
              <add prefix="http://dev.digital.SiteName.com" />
              <add prefix="http://dev.digital.SiteName.ca" />
            </baseAddressPrefixFilters>
      </serviceHostingEnvironment>
        <services>
          <service behaviorConfiguration="SPWCFService.SPService1Behavior"name="SPWCFService.SPService1">
            <endpoint binding="wsHttpBinding" contract="SPWCFService.ISPService1" />
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="SPWCFService.SPService1Behavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    </configuration>

    Her is my full stack trace. I am seriously baffled.

    Stack Trace:
    [ArgumentException: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
    Parameter name: item]
    System.ServiceModel.UriSchemeKeyedCollection.InsertItem(Int32 index, Uri item) +15612908
    System.Collections.Generic.SynchronizedCollection`1.Add(T item) +65
    System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri[] addresses) +62
    System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +266
    System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +42
    System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +427
    System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +604
    System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +46
    System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +654

    [ServiceActivationException: The service '/_wcf/SPService.svc' cannot be activated due to an exception during compilation. The exception message is: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
    Parameter name: item.]

    System.ServiceModel.AsyncResult.End(IAsyncResult result) +15626880
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +15546921
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +265
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +599
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171

    If anyone has any suggestions for how I can get around this issue I would love the insite. I am fairly new to WCF however last time I did use it i certainly did not get the above error. So, I am a lost little dev on this one.

    Monday, October 26, 2009 9:21 PM

Answers

  • Hi,

    CAn you try changing  the baseAddressPrefixFilters. You can only have one addres per protocol. You can have two addresses there,but,for eg one can be http address and the other net.tcp address. Try removing one of the addresses and check.

     <add prefix="http://dev.digital.SiteName.com" />
              <add prefix="http://dev.digital.SiteName.ca" />


    http://thoughtorientedarchitecture.blogspot.com/
    • Marked as answer by JosephIM Tuesday, October 27, 2009 2:51 PM
    Tuesday, October 27, 2009 12:26 AM