locked
DBML blows my WCF Service RRS feed

  • Question

  • I have a working WCF service that includes a simple "TestAlive" method that passes back "alive" to the caller.  I have other complex methods that also work fine.  then I added a LINQ to SQL dbml file containing two simple tables.  In the code pasted below, the instantiation of db causes all of my service methods to return notfound.  I found this by sniffing it out in Fiddler.  I verified by removing the DBML and the instatiation of db.  Why is this happening and what can I do to fix it?  Is this a WCF or LINQ bug?

        [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
        public class Service1 : IService1
        {
           
            RTTDataContext db = new RTTDataContext();   <---this causes all of my methods to return notFound

    Thanks,

    Dean


    .net Developer
    Saturday, October 1, 2011 8:59 PM

Answers

  • Found my WCF LINQ problem.  If you delete and replace a DBML in a VS2010 project it does a little favor for you by appending a "1" to the database connection name making "DataSourceConnectionString" into "DataSourceConnectionString1" (why do they do stuff like this?).  It kindly puts another connection string into your dev web.config.  But of course when I deploy it to my public server I missed this.

    When I instantiate the datacontext on the deployed server it triggers a web exception giving the client the ever descriptive not found.  I would have never found this if not for Fiddler.

    Dean


    .net Developer
    • Marked as answer by Dean Blakely Sunday, October 2, 2011 5:05 PM
    Sunday, October 2, 2011 5:05 PM

All replies

  • Found my WCF LINQ problem.  If you delete and replace a DBML in a VS2010 project it does a little favor for you by appending a "1" to the database connection name making "DataSourceConnectionString" into "DataSourceConnectionString1" (why do they do stuff like this?).  It kindly puts another connection string into your dev web.config.  But of course when I deploy it to my public server I missed this.

    When I instantiate the datacontext on the deployed server it triggers a web exception giving the client the ever descriptive not found.  I would have never found this if not for Fiddler.

    Dean


    .net Developer
    • Marked as answer by Dean Blakely Sunday, October 2, 2011 5:05 PM
    Sunday, October 2, 2011 5:05 PM
  • Hi Dean,

    Thanks for sharing your experience here!

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, October 3, 2011 3:01 AM
    Moderator