Silverlight Webservices

Discussion in 'Silverlight' started by rohito, Feb 21, 2008.

  1. Has anyone tried setting up a webservice to communicate with silverlight (client side code) successfully?
    Mine runs fine in the virtual development server (VS 2008), but has problems on the webserver.

    Cheers!
     
  2. I've got a similar issue (may be the same), below is my error message. Also go to http://nokolacom00.web701.discountasp.net/services/to see it. Any help is greatly appreciated! Maybe we have to run "ServiceModelreg -i in c:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation " in order to install WCF correctly? I had similar issue on my local box and fixed it with the above command.

    Please help!

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

    <FIELDSET><LEGEND>Detailed Error Information</LEGEND>




    Module
    IIS Web Core

    Notification
    BeginRequest

    Handler
    Not yet determined

    Error Code
    0x800700b7

    Config Error
    Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'ScriptHandlerFactory'

    Config File
    \\?\E:\web\nokolacom00\htdocs\services\web.config




    Requested URL
    http://nokolacom00.web701.discountasp.net:80/services/

    Physical Path
    E:\web\nokolacom00\htdocs\services\

    Logon Method
    Not yet determined

    Logon User
    Not yet determined
    </FIELDSET>

    <FIELDSET><LEGEND>Config Source</LEGEND>
    Code:
    [b]  119: 			<remove name="WebServiceHandlerFactory-Integrated"/>
    [i]  120: 			<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>[/i]
      121: 			<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    [/b]
    </FIELDSET>

    <FIELDSET><LEGEND>Links and More Information</LEGEND>This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.


    View more information ยป</FIELDSET>
     
  3. Note: this service works perfectly on my local machine
     
  4. Sorry, I just redeployed everything at /, and when trying to access the service:


    http://nokolacom00.web701.discountasp.net/ShockService.svc

    I get this:


    Server Error in '/' Application.


    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:






    Code:
    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) +4564833
       System.Collections.Generic.SynchronizedCollection`1.Add(T item) +56
       System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri[] addresses) +120
       System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +145
       System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +28
       System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +323
       System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +516
       System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +31
       System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +498
    
    [ServiceActivationException: The service '/ShockService.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) +4413209
       System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +183
       System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +205
       System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +322
       System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +64
    




    Version Information:Microsoft .NET Framework Version:2.0.50727.1434; ASP.NET Version:2.0.50727.1434 <!--
    [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
    at System.ServiceModel.UriSchemeKeyedCollection.InsertItem(Int32 index, Uri item)
    at System.Collections.Generic.SynchronizedCollection`1.Add(T item)
    at System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri[] addresses)
    at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
    at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses)
    at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
    at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
    at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
    at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
    [ServiceActivationException]: The service '/ShockService.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.
    at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
    at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
    at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext)
    at System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e)
    at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    --><!--
    This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using <customErrors mode="Off"/>. Consider using <customErrors mode="On"/> or <customErrors mode="RemoteOnly"/> in production environments.-->
     
  5. ok everything works for me now...i created a new web site in vs (New -> web site from solution, then selected WCF service), then created a custom factory for it, and added a silverlight link
     
  6. i am getting the same error though my service has nothing to do with silverlight.
    i createdthe "WCF Application" in Visual Studio 2008 with dependency on .net 3.5.
    the WCF service works on my local machine but i can't get it to work on discountasp.net.
    i published my service to a new IIS application folder. when i browse to it i get...

    Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'ScriptHandlerFactory'
    134: <remove name="WebServiceHandlerFactory-Integrated"/>
    135: <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
    136: type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    you might be able to see the same error at http://www.timesupkidz.com/operations/service1.svc

    i have no idea how to fix this problem.
     
  7. i deleted all the offending lines from the web.config. now i get...

    This collection already contains an address with scheme http
     
  8. i then modified the web.config as follows, which seemed to fix the problem
    when it was deployed to discountasp but causes it to fail on my dev machine.
    i wish i didn't have to do any of this, esp when i don't understand what is going on.




    <system.serviceModel>


    <serviceHostingEnvironment>





    <add prefix="http://www.timesupkidz.com/operations" />


    </baseAddressPrefixFilters>
     

Share This Page