Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 09, 2012 02:00 AM by Decker Dong - MSFT
May 07, 2012 12:15 PM|LINK
I am trying to use the Entity Framework data connection in a Windows Service I have created. The EF model and classes are in a seperate data access assembly. I am referencing the assembly in my service. The coding compiles without any errors. I am using
using (EntityModel context = new EntityModel)
var list = (from a in ctx.TableName Select a);
\\Some insertions to database using EF
But the database entry is not working in a windows service even though I reference the data access library.
May 07, 2012 12:22 PM|LINK
Is the entity framework's connection string in the windows service's app config?
May 07, 2012 12:24 PM|LINK
Yes I have included the connection string in the windows service's app config. Since Windows Service does not contain an app config, I manually added an app config file and entered the connection string located in my EF model. As I have said the data access
logic contains the Entities and logic.
May 09, 2012 02:00 AM|LINK
And here's my suggestion for you：
1）You can try to use ASP.NET's work Service。
2）You can also try to use WebService or WCF or something like this to deal with the problem。