Last post Jan 24, 2020 03:58 PM by dmcdivitt
Jan 23, 2020 08:47 PM|dmcdivitt|LINK
Microsoft Visual Studio Professional 2019 Version 16.4.3, Microsoft .NET Framework Version 4.8.03761
To learn MVC I found a good tutorial. It had me create a blank MVC project then run, saying a "resource not found" error would appear and it did. It had me create a "Home" controller and in the "Index" method return a hello world string. The "resource not
found" error went away as it should have. It had me append "/Process" to the URL in the browser saying the "resource not found" would appear again and it did. It had me edit RouteConfig.cs to add a mapping for "Process" with default action "List" and add
a "Process" controller with "List" method to return a similar string. The app will not render the string with /Process or /Process/List but keeps saying "resource not found." I edited the default mapping replacing "Process" for "Home" and "List" for "Index".
The string would then render as the default mapping, proving that the ProcessController does work. I am not able to make the string render using the mapping /Process/List pursuant to the lesson. The link given above has the page in the lesson where this should
work and all code exactly matches the page. I like this tutorial better because it starts with a totally blank project, but the same thing happens with a different tutorial.
Jan 23, 2020 09:06 PM|dmcdivitt|LINK
The "Process" mapping as given in the tutorial did not have named arguments. I named the arguments and it still doesn't work.
Jan 24, 2020 05:09 AM|Yongqing Yu|LINK
According to the reference link you provided, I tested it in the same way as above and did reproduce the error you mentioned.
After investigation, I found that the MapRoute added in the RouteConfig, if you copy the content directly from the reference document, it will indeed cause an error.
The MapRoute content provided by the reference document is shown below：
controller = " Process", action = "List ", id =
The places I marked with color include spaces before and after, which will make your path names inconsistent with route.
To solve this issue, you just need to delete the spaces in the place where I marked in the RouteConfig file, or directly replace the content below:
controller = "Process",
action = "List",
Jan 24, 2020 03:47 PM|dmcdivitt|LINK
@Yongqing Yu, I noticed the space on either side of the values and removed that, but it still doesn't work for me. Thank you for trying the tutorial. What version of Visual Studio do you have? I read an article saying the latest versions have different functionality
related to this issue but I can't find the article again.
Jan 24, 2020 03:58 PM|dmcdivitt|LINK
@Yongqing Yu, you were correct. I did not remove all of the spaces! I looked again to be sure after your reply. Thank you very much.