Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# ASP.NET MVC Basics Views Adding a View

Davis Mercier
Davis Mercier
7,805 Points

500 Error

I keep getting a 500 error every time I run the site. I've gone through the video multiple times and every line of code and file name matches. Has anyone else encountered this problem and been able to fix it? Thanks

Samuel Ferree
Samuel Ferree
31,722 Points

Can you paste the error?

Is there a stack trace that goes a long with it? Is anything printing to your console?

500 Error encompasses every possible server error, so any extra information you have will be super helfpul.

Davis Mercier
Davis Mercier
7,805 Points

System.InvalidOperationException The view found at '~/Views/comicbooks/detail.cshtml' was not created.

Description: HTTP 500.Error processing request. Details: Non-web exception. Exception origin (name of application or object): System.Web.Mvc. Exception stack trace: at System.Web.Mvc.BuildManagerCompiledView.Render (System.Web.Mvc.ViewContext viewContext, System.IO.TextWriter writer) [0x00061] in <cc73190bab9d435c831510ff295c572a>:0 at System.Web.Mvc.ViewResultBase.ExecuteResult (System.Web.Mvc.ControllerContext context) [0x00080] in <cc73190bab9d435c831510ff295c572a>:0 at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x00000] in <cc73190bab9d435c831510ff295c572a>:0 at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive (System.Collections.Generic.IList1[T] filters, System.Int32 filterIndex, System.Web.Mvc.ResultExecutingContext preContext, System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x0000b] in <cc73190bab9d435c831510ff295c572a>:0 at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive (System.Collections.Generic.IList1[T] filters, System.Int32 filterIndex, System.Web.Mvc.ResultExecutingContext preContext, System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x0004f] in <cc73190bab9d435c831510ff295c572a>:0

Samuel Ferree
Samuel Ferree
31,722 Points

Interesting, Some googling turned up this could be a MS bug that was fixed in RC2, do you know the version of .NET you are currently running?

Davis Mercier
Davis Mercier
7,805 Points

I am running this using Xamarin on a Mac which could be part of the problem, although it hasn't caused any issues until now. In the process of creating the files, I didn't see an option to view the version of .NET that was being used. Is there a way to check this for Xamarin or is this completely dependent on the current update?

Samuel Ferree
Samuel Ferree
31,722 Points

hmm, never worked with xamarin on a mac.... This may be beyond my skill to heal...

see if you can google how to verify your version of .NET for xamarin on mac.

Davis Mercier
Davis Mercier
7,805 Points

Everything I have read online seems to say my version of Xamarin is running .Net 4.5

3 Answers

James Churchill
STAFF
James Churchill
Treehouse Teacher

Davis,

If you can share your project with me (GitHub repo?), I'd be happy to debug it using Xamarin Studio on my Mac.

Thanks ~James

Davis Mercier
Davis Mercier
7,805 Points

Thanks James. I'm fairly new to GitHub, but I think I found how to add you as a collaborator. What username do you use on GitHub? Thanks again for any help.

Davis

James Churchill
James Churchill
Treehouse Teacher

Davis,

My GitHub username is "smashdevcode".

Thanks ~James

Davis Mercier
Davis Mercier
7,805 Points

I've just requested you be added as a contributor. Please let me know if you have any issue accessing any files and Thanks again!

James Churchill
James Churchill
Treehouse Teacher

Davis,

I was able to clone the repo. And I was able to successfully run the project and browse to "http://127.0.0.1:8080/ComicBooks/Detail" using both Xamarin Studio Community (6.0.2 build 73) and Visual Studio for Mac (Preview 3 [7.0 build 1077]).

I'm currently running Mono 4.8.0.

What versions are you using?

Thanks ~James

Davis Mercier
Davis Mercier
7,805 Points

I uninstalled and reinstalled xamarin and updated everything and it now seems to work, although I noticed the URL seems to be case sensitive. Is this always the case?

Kevin Gates
Kevin Gates
15,053 Points

https://www.quora.com/Is-ASP-NET-case-sensitive

Well, Its like asking β€œDoes science studies have future?”, one will definitely counter ask β€œWhich stream/major? computer science, physics, chemistry etc?” You get my point.

Aspnet is mix of components, libraries and languages. So valid questions could be:

Is C#/VB case sensitive? C#: YES, VB: NO,

Are URLs case sensitive? NO,

What about ASPX/Razor pages? These are view engines and view pages are written on top them are mix of html and C#/VB. HTML is case insensitive ( but attributes values are: id, class values)

Are configuration files case sensitive? YES its just XML.

Happy Coding!

I had a 500 error. I had to do Two things:

  1. I had to removed System.web.entities and replace it with System.Web.Http.Common

  2. This then led to another error with MvcWebRazorHostFactory, This required me to update from Version=5.2.3.0, to Version=5.2.7.0 in the view -> web.config file.

After this it finally worked.