Finally - I got an ASP.Net Core app to run! (Updated)
Here I go again...
I was following along with the Pluralsight course "Building a Web App with ASP.NET Core, MVC 6, EF Core, and Angular" but couldn't get the first demo app to run. I was stuck in Section 2 - Visual Studio! Bummer!
I created a new ASP.Net Core app from scratch and tried to run it out of the box and got the error you see at right. I had zero luck finding a solution online.
I searched through the code and the only place I found where there was a "type" property that was likely to be null (it's actually a string value in the file) was in the [app].vs\config\applicationhost.config file:
<configuration>
...
<configProtectedData>
<providers>
<add name="IISWASOnlyRsaProvider" type="" description="Uses RsaCryptoServiceProvider to encrypt and decrypt" keyContainerName="iisWasKey" cspProviderName="" useMachineContainer="true" useOAEP="false" />
...
</providers>
</configProtectedData>
...
/<configuration>
I did two things to get the app to run...
I'm using VS 2017 instead of VS 2015 which is what the course is using. I tried installing the Core functionality from the MS website as Shawn instructs but got an error stating that I needed VS 2015. I wasn't going to install that... Instead I found that if you use the VS Installer you can install the Core items through the VS Installer so I did.
I had to change the application target from IIS Express to the application name. I assume there's some issue with my IIS installation but I'm still working on that. Once I switched to running as a console app instead of IIS it worked. And, it only took me about 2 hours to get to this point!
Update 7/16/2017
After beating my head against the wall with this Core stuff, I found out one thing. Apparently VS 2017 doesn't work well when using a Core web application and the local IIS Express. Every thing I tried always resulted in the error shown above. Apparently VS 2017 and Core has an issue with IIS Express. I did NOT find any official MS documentation regarding this but found a Stackoverflow article which confirmed my findings: https://stackoverflow.com/questions/42121332/visual-studio-2017-doesnt-run-core-apps-with-iis-express.
If you choose the application in the debug emulator drop down instead of the IIS Express, it seems to work.
I also tried following along with some Pluralsight courses but they used VS 2015 and had too many differences compared to VS 2017 to make it worth while. I also tried following a video with Scott Hanselman but it was too slow. This video from MS is probably the best since it targets VS 2017: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/start-mvc but it seems pretty simple.
I'm still looking for a good education source regarding VS 2017 and Core! I need the one that feels just right!
Converting an MVC app to Core MVC
This is a good source from MS for converting an existing MVC app to Core MVC:
https://docs.microsoft.com/en-us/aspnet/core/migration/mvc
Comments
Post a Comment