none
My WCF Data Service doesn't work RRS feed

  • Question

  • Hi there:

    I'm following a book about WCF.

    I created a WCF Data Service but it won't work.

    I tried everything, but since I'm a newbie to WCF, maybe I'm not seeing something.

    I upladed the project to SkyDrive along with a BackUp of the DataBase i'm working with.

    It's created using VS2012, SQL Server Express 2012, Framework 4.5.

    I created a Blank Solution (ProductsSales), then

    • added a Class Library named ProductsSalesService
    • added an Entity Data Model to ProductsSalesService by using the wizard, and selecting generate from DataBase
    • Created the service contract IProductsSales with all the methods that will define the service
    • Implemented the ProductsSales REST Web Service
    • added a Console Application that will host the service (ProductsSalesHost)
    • in the Main method of ProductsSalesHost, I created a host  
    var host = WebServiceHost(typeof(ProductsSalesService.ProductsSales))
    host.open();
    ...
    host.Close();
    • copied the conn string defined in the ProductsSalesService App.Config file and copied to the App.Config of the ProductsSalesHost
    • opened the WCF Configuration dialog by right clicking the App.Config file of ProductsSalesHost
    • in the WCF Configuration Dialog I created a service by right clicking the Service folder of the Configuration pane, set th new service type as ProducsSalesService.ProductsSales
    • created a new endpoint by right clicking the Endpoints folder under the new service and set:
    •         Address     http://localhost:80/Sales
    •                 (I first tried with the port 8000, then changed it to 80 which is
    •                  how the uploaded code is set, useless!)
    •         Binding      webHttpBinding
    •         Contract    ProductsSalesService.IProductsSales
    • then tried to reserve the port 8000 by executing the following in the VS Command Prompt

    netsh http add urlacl url=http://+8000/ user=MyUserName

    • here I got several errors, saying "Url parameter add failed, error: 87. The parameter is incorrect
    • other times I get: Create SDDL failed, Error: 1332. The parameter is incorrect
    • The I logged off with my current user and logged on with the Administrator account, and tried to reserve the port from there, in one of those attempts I finnaly got the success message
    • but when I open a browser and type the url: "http://localhost:8000/Sales/Orders" I get an error saying that it's unable to connect. 

    What could it be?

    I really appreciate your help since I'm stuck for a while now.

    Rafael


    Believe you can do it, and you will!!




    Saturday, February 8, 2014 10:56 PM