Search code examples
.netvisual-studioazureazure-worker-roleswebrole

Linking Entity Framework Database between Web and Worker Roles in .NET


I have a project with both Web and Worker roles. Reading and writing to the database using Entity Framework in the Web role works fine. However, I am having issues when attempting to access data in that same database from the Worker role. It appears that the database is not being referenced properly because when I do a query, entries that I know exist do not get returned. Upon debugging, my breakpoints show that the database has 0 entries and I know this is not the case because the Web role accesses the same data without a problem.

I think the issue may be a setting or reference that I am missing, but I haven't been able to figure it out yet. Any help would be appreciated.


Solution

  • It turns out that the App.config was missing the entire portion of the configuration that was present in Web.config. Since the part of the App.config was missing entirely, I was not aware that this attribute was to be included in App.config as well.