Posts

Showing posts from May, 2016

Fixing the error: "The element 'entityFramework' has invalid child element 'providers'. List of possible elements expected: 'contexts'"

If you're getting the error message: The element 'entityFramework' has invalid child element 'providers'. List of possible elements expected: 'contexts'. and you're using Visual Studio 2012 or Visual Studio 2013, then you can download and install  Entity Framework 6 Tools for Visual Studio 2012 & 2013 . These tools update the schema used to validate the configuration files for your projects. Entity Framework 6 Tools for Visual Studio 2012 & 2013 https://www.microsoft.com/en-us/download/details.aspx?id=40762

Most Likely Cause of the C# Error: "Non-static method requires a target"

I've encountered this error twice in the last two days, both times occurring while with a LINQ query and Entity Framework. And, in both cases, the problem stemmed from using a null value within the LINQ. Ultimately, the problem was farther upstream and not with my LINQ query at all (though better use of a try-catch statement would've been smart). The problem was an object with a null value being passed into the method. Once I figured that out, it was fairly easy to step through the debugger and see where my object wasn't being set to a legitimate value. So, if you get the error "Non-static method requires a target,", then verify that every value you're using within your LINQ statement contains a value, not a null. See the following posts on the web for more information and resolution to this error. Non-static method requires a target http://stackoverflow.com/questions/13717355/non-static-method-requires-a-target EF Non-static method requires a targe

ASP.NET Routing Not Working in IIS

After deploying a brand new website to IIS on Windows Server 2008 R2, I encountered numerous issues. First, the web pages had no no styling. I could "View Source" and see that the code was correct, and I could browse to the folder containing the style sheets (bootstrap, my new obsession) and bring up the style sheet itself, but the application couldn't find the style sheets at run time on its own. Next, none of the links worked. The page "StudentsList", which should bring up "StudentsList.aspx" returned a HTTP 404 status. After futzing around a bit, it dawned on me that both issues stemmed from routing problems. In no time, I found several suggestions -- including good ol' Rick Strahl's blog -- most of which pointed to the same fix. Add the runAllManagedModulesForAllRequests attribute to the <modules> tag of the <system.WebServer> section of the web.config file. See Strahl's entry for more details: https://weblog.wes