WCF Client & Service Sample

Discussion in 'ASP.NET / ASP.NET Core' started by jfasenmyer, Jan 21, 2008.

  1. Has this forum been here the whole time? If so, I don't know how in the world I missed it. Either way, since you guyshave'officially' set up a support forum can we PLEASE PLEASE PLEASE have a working WCF sample (client AND service samples)? Please? I'm referring to my original thread posted here. Please?
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    I thought Aristotle gave you a sample code. Didn't that work?

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  3.  
  4. I did check intosome ASP.NET compability articles. Changing the setting in the web.config resulted in the same error. I did just notice in the article you linked thatI have theaspNetCompatibilityEnabledset to true anddo not have any [AspNetCompatibilityRequirementsMode]attribute defined in the code. It's possible this setting could be somehowcausing the problem but you'd think the error would further imply it if that were the case. Either way I'll test this out & let you know the outcome. Again, your help is greatly appreciated.

     
  5. Having the same problem. Frustrating.

    [​IMG] can someone be a hero and post a simple "Hello World" sample of a WCF client and server in VB .Net 2008 using IIS7 hostingand the wsbinding?

    Maybe also some simple notes of setting up in IIS7 [​IMG]
     
  6. I'd help with some code tests for this but recently switched to Vista and am still getting my Dev tools configured.
    Something you may want to check out however, for good resources, is...
    http://netfx3.com/content/WCFHome.aspx
    Salute,
    Mark

    Note: The transition to Vista hasn't been bad at all.
    Only problem I've hadso far is my current version of Camtasia Studio.
    Fortunately the upgrade toC.S. v5 will take care of that, unfortunately the upgrade is $150. [​IMG]
     
  7. Thanks Mark

    I am going to post whatever I find back here also.
     
  8. Bruce

    Bruce DiscountASP.NET Staff

  9. I found some sample code on how to implement a WCF service that fixes this issue:


    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



    Details are on Rob Zelts blog:


    http://www.robzelt.com/blog/CommentView,guid,b53a709e-cd21-460f-a33b-c7a8e02e8bd6.aspx#commentstart


    You need to implement a custom service factory, custom service host and modify the SVC file to reference the factory.


    class CustomHostFactory : ServiceHostFactory {


    protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) {


    CustomHost customServiceHost = new CustomHost(serviceType, baseAddresses[1]);


    return customServiceHost;


    }


    }


    class CustomHost : ServiceHost {


    public CustomHost(Type serviceType, params Uri[] baseAddresses) : base(serviceType, baseAddresses) { }


    protected override void ApplyConfiguration() {


    base.ApplyConfiguration();


    }


    }


    <%@ ServiceHost Language="C#" Debug="true" Service="HelloWorldService.Service1" Factory="HelloWorldService.CustomHostFactory" CodeBehind="Service1.svc.cs" %>


    Note: In development I had to change this line of code from


    CustomHost customServiceHost = new CustomHost(serviceType, baseAddresses[1]);


    to


    CustomHost customServiceHost = new CustomHost(serviceType, baseAddresses[0]);


    To get it to work locally. I then change that line backbefore publishing to my site.


    I've attached the complete VS2008 project solution.


    -bob familiar
     

    Attached Files:

Share This Page