WCF Error

Discussion in 'Site Programming, Development and Design' started by bakersman, Mar 19, 2010.

  1. Hi,

    I get the following error when trying to access my WCF service:

    HTTP Error 500.19 - Internal Server Error
    The requested page cannot be accessed because the related configuration data for the page is invalid.

    Find attached my wcf service. You can try to access the service at http://www.pgbwt.com/calendar/WCF/Service.svc to see the error for yourself.

    Is this perhaps a problem with the web.config file?

    Do you have one that works that I can modify for my WCF Service? What should I do to fix it?

    Regards
    Renier
     

    Attached Files:

  2. Ray

    Ray

    It looks like your application is loading two of the same names "ScriptHandlerFactory". Somewhere in your code this name is already loaded. Could be due to inheritance. As a test try disabling the inheritance property in your web.config. You may want to disable it from the root.

    <location path="." inheritInChildApplications="false">

    <system.web>
    </system.web>
    </location>
     
  3. Hi,

    Thanks for the reply, it seemed to have helped a bit.

    I now have a new error :p

    This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
    Parameter name: item
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    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

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    Code:
    [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) +11526110
       System.Collections.Generic.SynchronizedCollection`1.Add(T item) +67
       System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri[] addresses) +49
       System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +129
       System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +28
       System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +331
       System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +11666348
       System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +42
       System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +479
    
    [ServiceActivationException: The service '/wcf/kgvmswcf.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) +11536522
       System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +194
       System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +176
       System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +278
       System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
    
    Any Suggestions?
     
  4. Ray

    Ray

    Check your http bindings in your web service and make sure you only have one address.
     
  5. This happens with shared hosting. The wcf dispatch runtime doesn't use IIS host headers to route the service calls so it is basically running into the same issue you would have trying to host two sites in IIS on the same port without host headers. To get around this you should add the following under <system.serviceModel>

    <serviceHostingEnvironment>
    <baseAddressPrefixFilters>
    <add prefix=”http://www.yoursitehere.com”/>
    </baseAddressPrefixFilters>
    </serviceHostingEnvironment>

    Wasn't sure if this was still an issue for you but figured it might help someone else who may run into it.
     
  6. Thanks for throwing that out there.
     
  7. @epiclist: THANK YOU!!! That's exactly what I needed. I was also getting "This collection already contains an address with scheme http" exceptions.
     

Share This Page