• Aikido
  • Healthcare/Clinical
  • LINK-12
  • Pandora’s Box
  • Tin Foil
  • What is Michael?
  • Projects
    • Personal Projects
  • IPv6 Secure Project

The Krypt

The Krypt

Tag Archives: MVC 5

Untangling Some MVC 5 Problems

09 Tuesday Aug 2016

Posted by Michael in .NET, Development, Systems Integration

≈ Leave a comment

Tags

controller, CS1061, Entity Framework, MVC 5, Service Broker, Visual Studio

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.

mvc-project-properties-1

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:

iis-select-virtual-directory

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.

mvc-project-properties-2

CS1061: Does Not Contain Definition and no Extension Method

object-reference-not-set-to-instance

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‘.

redo-add-controller-and-views

This time, double-check the ‘Reference script libraries‘ option is not selected, and leave the ‘Use a layout page‘ field is blank.

Advertisements

Share this:

  • Twitter
  • Facebook
  • Google
  • Reddit
  • LinkedIn
  • Email

Like this:

Like Loading...

Menu

  • Register
  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.com

Categories

  • .NET
  • Communications
  • Cryptography
  • Development
  • Forensics and Investigation
  • IPv6
  • Linux OS
  • Martial Arts
  • networking
  • privacy
  • Python
  • Systems Integration
  • Uncategorized

Profile

Michael

Michael

My name is Michael, and I’m a software developer specialising in clinical systems integration and messaging (API creation, SQL Server, Windows Server, secure comms, HL7/DICOM messaging, Service Broker, etc.), using a toolkit based primarily around .NET and SQL Server, though my natural habitat is the Linux/UNIX command line interface. Before that, I studied computer security (a lot of networking, operating system internals and reverse engineering) at the University of South Wales, and somehow managed to earn a Masters’ degree. My rackmount kit includes an old Dell Proliant, an HP ProCurve Layer 3 switch, two Cisco 2600s and a couple of UNIX systems. Apart from all that, I’m a martial artist (Aikido and Aiki-jutsu), a practising Catholic, a prolific author of half-completed software, and a volunteer social worker.

View Full Profile →

GitHub

Blogs

  • Alexander Riccio
  • Brian Krebs
  • Bruce Schneier
  • Chris Lansdown
  • cypherpunks
  • Daniel Miessler
  • Dimitrios
  • Dirk Rijmenants
  • EXTREME
  • George Smith
  • Jeffrey Carr
  • Jericho@Attrition
  • Krypt3ia
  • Light Blue Touchpaper
  • MNIN Security
  • Pen Test Lab
  • Strategic Cyber LLC Blog
  • Tech Antidote
  • The Pro Hack
  • UWN Thesis
  • Volatility Labs
  • W.M. Briggs

Catholica

  • Bible Gateway
  • Brandon Vogt
  • Catholic Answers
  • Jacqueline Laing
  • Patrick Coffin
  • Rational Catholic
  • Rosary Confraternity
  • Strange Notions
  • Theology Like a Child
  • Thomas Aquinas' Works
  • Vericast
  • Word on Fire

Cryptography

  • Cipher Machines and Cryptology
  • Crypto Museum
  • Matthew Green

Developers

  • CodeAcademy
  • Codemanship
  • Hacker News
  • Puneet Kalra
  • SWLUG

InfoSec

  • Airbus Cyber Security Blog
  • Cryptome.org
  • Fuzzy Security
  • Linux Security
  • OSVDB
  • Packet Storm Security
  • PHRACK
  • Qjax Blog
  • RISKS Digest
  • SecTools.org
  • Strategic Cyber LLC Blog

Interesting Stuff

  • 27b/6
  • Attrition Online
  • Frank Langbein
  • Learn WordPress.com
  • Theme Showcase

Martial Arts

  • AikiCast
  • Aikido Journal
  • Aikido Sangenkai
  • AikiWeb
  • Welsh Aikido Society

ISTQB Certified Tester

Update by RSS

  • RSS - Posts
  • RSS - Comments
Advertisements

Create a free website or blog at WordPress.com.

Cancel
loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.
%d bloggers like this: