I have a ASP.Net Web Forms application (project 1), an Entity Framework data access library (project 2) and a WCF service library (project 3). The Asp.Net project has an *svc file that redirects calls to the corresponding WCF service in project 3. I am debugging locally using VS 2012 (+ its integrated server) and thus NO IIS is used.
I am encountering the following problem: if I use a page inside project 1 to get some data from the EF database, everything works fine, but when I use a remote WCF client to call the same method, if fails. The error says that the connection string for the database couldn't be found. Upon investigating, I figured out that the if I call the query from the ASP project, the connection string located in Web.config file of project 1 is correctly used. However, if I call the query over the WCF service, the App.config of the service library is used (which of course doesn't contain any connection strings).
Up until now I thought that .NET does NOT support fragmented configuration files for DLLs (this is the reason why you have to copy over the endpoint/service configuration elements from the service App.config to the ASp.Net Web.config file).
So does anybody know how I can get my service to use the Web.config instead it's very own App.Config, which it shouldn't use anyways?
Edit: added code for *svc file and service interface + service implementation
SimulatorWcfServices.svc (project 1: the main ASP.Net Web Application):
<%@ ServiceHost Language="C#" Debug="true" Service="Blub.SimulatorWcfServices.DataExchangeService" %>
IDataExchangeService.cs (project 3: the SimulatorWcfServices service library)
[ServiceContract]
public interface IDataExchangeService
{
[OperationContract]
IDictionary<string,string> GetData();
}
DataExchangeService.cs (project 3: the SimulatorWcfServices service library)
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class DataExchangeService : IDataExchangeService
{
public IDictionary<string, string> GetData()
{
return new DataAccessImplementation.DataDAO().GetAllData(); //call to project 2
}
}