Home

No connection string named "{ConnectionName}" could be found in the application config file

So I've had this question for a while now. I have EF6 data context (PICS.EF). I also have a separate dll for business logic (PICS) that uses that PICS.EF. I've setup PICS.EF as a connection in LINQPad and I can use it without any issues. I can also create a new query and call my PICS dll without any problems. What I can't do is have a query with the PICS.EF connection selected where I also call any class in PICS that utilizes the PICS.EF context. I get the following error: "No connection string named "{ConnectionName}" could be found in the application config file. The error is not while using the selected connection's context, it when using the 'PICS` dll."

My guess is that PICS is looking for the connection string in the wrong App.config file, or it simply cannot find it where it expects it to be.

Hope you guys can help :)

Comments

  • I can't see why. Do you see the right connection string when you run this query?

    File.ReadAllText (AppDomain.CurrentDomain.SetupInformation.ConfigurationFile).Dump();

  • Thank you for the clue, mystery solved! When I added the connection to LINQPad, I utilized the config file from my PICS.EF dll instead of the one from PICS which didn't have the appropriate entries in the <connectionStrings> section.
    Man you're good! :) Best regards from Belgium.

Sign In or Register to comment.