Deployed WCF web services gives message "has not been pre-compiled"

Discussion in 'ASP.NET WebServices' started by mdobbles, Aug 29, 2008.

  1. I created a WCF web service called LinkDatabaseService that I access from a Silverlight client. When it runs on localhost it works fine. The service even successfully puts and retreives data in my discountAsp.net hosted SQL Server database. When I deploy the application it doesn't work. Which at first made sense to me because the reference to the webservice in my Silverlight application was to one located at addresshttp://localhost:59546/LinkDatabaseService.svc. So I go and update the webservice reference and try to set the address to my website http://www.silverlightwebapps.com/LinkDatabaseService.svc. I can ftp to the site and see that the service is there and in the bin directory is a dll with the same name as the web project (LinkDatabaseWeb.dll). However when I try this I get the message that "the file /LinkDatabaseService.svc has not been pre-compiled, and cannot be requested".

    Any suggestions? I'm using VS2008. I looked around through the options and I don't see a "pre-compile" option.
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    Do you have a precomplied.config in the application folder (on the server)?

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Yes. I have precompiled.config in my root (not bin) directory which is the same directory as my LinkDatabaseService.svc.


    Below is the content of procompiled.config:


    <precompiledApp version="2" updatable="false"/>
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    if you have this file, you cannot just put a web service file there w/o precompiling.


    Do you use VS.NET's Publish function? If so, it will precompile your site. You may want to use Copy Website.


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  5. I think I figured out the "has not been pre-compiled" stuff. I was publishing two websites to the same account. One was precompiled and one wasn't. I now have a new account dedicated to this project. What I'm trying to do is demonstrate a silverlight application that talks to a wcf webservice that then talks to a database.

    When I run locally the silverlight client has a service reference to http://localhost:49797/DemoService.svc. DemoService has two methods that submit and get data from a database. When run locally it works fine and indeed submits data to my discountasp.net located database.

    Once it's published however, it can't use localhost. So now I try to reconfigure my service reference tohttp://uiprototype.web702.discountasp.net/DemoService.svcbut when I try this I get the error message:

    "This collection already contains and address with the scheme http. There can be at most one address per scheme in this collection."

    You can try out the SilverlightApp at the address below (with service ref configured to localhost).


    http://uiprototype.web702.discountasp.net/SilverlightClientTestPage.html
     
  6. Bruce

    Bruce DiscountASP.NET Staff

  7. I incorporated theanswers above into a step-by-step tutorial on how to build a datacentric silverlight web app that uses WCF andLINQ to submit and retreive data from a database. You can check it out at my blog at http://www.silverlightwebapps.com/Tutorials.aspx
     
  8. Bruce

    Bruce DiscountASP.NET Staff

Share This Page