1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Services Error

Services Error

3 posts, 1 answered
  1. Bryan
    Bryan avatar
    62 posts
    Registered:
    20 Jul 2010
    27 Aug 2010
    Link to this post
    I am getting the following error with the services in Sitefinity 4.0 beta.  This example is the PagesService but it is happening with taxonomy and others as well.  I have done some research on the net and people indicate it is an issue with host headers on a shared host.  I added the following to my system.serviceModel config:

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true">
      <baseAddressPrefixFilters>
        <add prefix="http://webstaging"/>
      </baseAddressPrefixFilters>
    </serviceHostingEnvironment>

    [ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
     
    Parameter name: index]
     
       System.ThrowHelper.ThrowArgumentOutOfRangeException() +78
     
       System.Collections.Generic.List`1.get_Item(Int32 index) +53
     
       System.Collections.ObjectModel.ReadOnlyCollection`1.get_Item(Int32 index) +81
     
       System.ServiceModel.Web.WebServiceHost.AddAutomaticWebHttpBindingEndpoints(ServiceHost host, IDictionary`2 implementedContracts, String multipleContractsErrorMessage) +96
     
       System.ServiceModel.Web.WebServiceHost.OnOpening() +276
     
       Telerik.Sitefinity.Utilities.MS.ServiceModel.Web.WebServiceHost2.OnOpening() +40
     
       Telerik.Sitefinity.Web.Services.DefaultServiceHost.OnOpening() +9
     
       System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +397
     
       System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +135
     
       System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +654
     
     
     
    [ServiceActivationException: The service '/Sitefinity/Services/Pages/PagesService.svc' cannot be activated due to an exception during compilation.  The exception message is: Index was out of range. Must be non-negative and less than the size of the collection.
     
    Parameter name: index.]
     
       System.ServiceModel.AsyncResult.End(IAsyncResult result) +15700960
     
       System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +15623609
     
       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

    Before applying the above config change, I get this error:

    [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) +15583484
     
       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.Web.WebServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +10
     
       Telerik.Sitefinity.Utilities.MS.ServiceModel.Web.WebServiceHost2..ctor(Type serviceType, Boolean dummy, Uri[] baseAddresses) +77
     
       Telerik.Sitefinity.Web.Services.DefaultServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +15
     
       Telerik.Sitefinity.Web.Services.WcfHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +45
     
       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 '/Sitefinity/Services/Pages/PagesService.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) +15700960
     
       System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +15623609
     
       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

    As with others who are having the same issue, the application is working fine on my local machine for development but this error happens when I deploy the app to a staging server.

    Thanks,
    Bryan


  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    01 Sep 2010
    Link to this post
    Hello Bryan,

    Thank you for using our services.

    I have setup a website on local IIS and have managed to reproduce the issue. It seems that it is coming from the WcfHandlerFactory - we need to provide further configurations for RESTful WcfServices so that you are able to select a default http binding for the services. I have noticed that in another forum thread you  have provided a workaround for this problem. Thank you for sharing your fix. We are going to resolve this issue for our future releases of the CMS.

    I have updated your Telerik Points. If you encounter any other problems please feel free to let us know.

    Sincerely yours,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. Bryan
    Bryan avatar
    62 posts
    Registered:
    20 Jul 2010
    01 Sep 2010
    Link to this post
    Very cool!  Thanks Radoslav.
3 posts, 1 answered