The following are fixes to some problems I encountered while building a Messaging Dashboard application using MVC 5 and Entity Framework 6.
Message Queue Doesn’t Appear in Entity Framework Model
Unlike a conventional database table, a message queue in the Service Broker part of the database cannot be imported into the Entity Framework model, and Entity Framework can’t read the queue through a stored procedure either (at least not without going through a Web Service).
As a workaround, in the SQL Server Management Studio, create a view for whichever message queue in the Service Broker. Next, import that view into the Entity Framework model for the application.
Error 404: Cannot Find Resource
In my case the problem was related to routing and the startup order of the application components. To resolve this, open the project’s properties and enter the Web section. Clear the Specific Page text box, and check the ‘Current Page‘ radio button.
After doing this, the application should be able to execute in debug mode, either by right-clicking whichever .cshtml file and selecting ‘Set As Start Page‘ or ‘View in Browser‘.
If the same problem persists, run the IIS Manager and ensure the application has an entry under Default Sites while it’s executing. In the Browse for Directory, find and select the location where the Visual Studio project is stored:
Back in the Visual Studio project’s properties, within the Servers section, click the Create Virtual Directory button, to load the virtual directory into IIS.
CS1061: Does Not Contain Definition and no Extension Method
As far as I can determine, the problem is a mismatch somewhere between the Model, Controller and View layers when referencing the object, and I think this happened because Visual Studio didn’t build the Controller-View ‘scaffold’ properly.
Scrap the Controller and Views for the database table/queue, and leave the Model in place. Next, create a new Controller, this time by selecting ‘Add‘ – ‘Controller…‘ instead of ‘New Scaffolded Item…‘, and as before, select the ‘MVC 5 Controller with with views, using Entity Framework‘.
This time, double-check the ‘Reference script libraries‘ option is not selected, and leave the ‘Use a layout page‘ field is blank.