ASP. NET MVC 6:https://docs.asp.net/en/latest/mvc/index.html
ASP. core:https://docs.asp.net/en/latest/fundamentals/index.html
Cli-samples:https://github.com/aspnet/cli-samples
Here are some of the lessons I have learned in the process of making this record
Complain!
Microsoft's release Candidate is really a pit-daddy.
1: Starting in early March to see ASP. NET Core, using 2015 to build a test project, all normal OK, can be said to be one step no problem ( happy, feel almost heaven )
2: Unfortunately, this week to update the project to RC2, the project package restore has been the error: " reference (Error-See" Error List ")" ( loss, anger, manic ... ) )
3: Looking around, finally getting. NET Cross-platform Journey: Upgrade the sample site from ASP. RC1 to ASP. 1.0, and be overjoyed.
4: Today, after using dotnet Restore to update the package and GG again.
Questions?
The brain is not enough to use Ah, who has more to me two Jin!
After 1:cr2, how do I host a project to IIS or IIS Express?
2: Why I am 2015, I right-click Reference-the Restore package always error " reference (Error-See" Error List ")", but after using dotnet Restore on the command line is normal.
3: Sometimes there will be "no actions matchedthe current request" error, say what the route has been matched successfully, but the request does not match the action, which is a stem? But after I re-modified the Startup.cs file, it's ready again!
............
N:and so on.
Basic Configuration
Date:March 17, 2016 19:05:03
1, Program entry configuration (Program.cs):
Public classprogram{ Public Static voidMain (string[] args) { varHost =NewWebhostbuilder (). Useserver ("Microsoft.AspNetCore.Server.Kestrel") . Usecontentroot (Directory.GetCurrentDirectory ()). UseDefaultConfiguration (args). Useiisplatformhandlerurl (). Usestartup<Startup>() . Build (); Host. Run (); }}
Useapplicationbasepath (Directory.GetCurrentDirectory ())
Usecontentroot (Directory.GetCurrentDirectory ())
Anyway, it's unclear why, record it.
2, startup program (Startup.cs):
Public classstartup{ Public voidconfigureservices (iservicecollection services) {services. Addmvc (); Services. AddTransient<Model.Services.StatisticsService>(); } Public voidConfigure (Iapplicationbuilder app, Ihostingenvironment env, Iloggerfactory loggerfactory) {app. Usemiddleware<artifacts. Middlewares.timerecordermiddleware>(); Loggerfactory.addconsole (Loglevel.debug); App. Useiisplatformhandler (); App. Useforwardedheaders (Newforwardedheadersoptions {forwardedheaders=Forwardedheaders.all}); App. Usestaticfiles (); if(env. Isdevelopment ()) {app. Usedeveloperexceptionpage (); } app. Usemvcwithdefaultroute (); }}
After you have configured the Ingress program and the startup program, dotnet the Restore update package by command, and then type dotnet run to open the self-hosted service.
You can load the page through the default route via http://localhost:5000.
OK, so that's the simple configuration.
Simple process from no-build station
1,win + R type cmd, and then navigate to a directory (my directory is D:\ASP. NET).
d:\asp.net> in D:\ASP.NET.
2, initialize a simple base. NET project by command dotnet New.
d:\asp.net>dotnet restorelog for d:\asp.net\project.json...info:committing Restore ... log in 4200ms. NuGet Config files used: D:\ASP.NET\NuGet.Config C:\Users\Administrator\AppData\Roaming\NuGet\ Nuget.configfeeds used: https://dotnet.myget.org/f/dotnet-core/api/v3/Index.json https: //api.nuget.org/v3/index.json
3. Enter the command to start dotnet Run and start the program.
d:\asp.net> for dnxcore,version=v5.0compilation succeeded. 0 Warning (s) 000:00:03.2201958HelloWorld!
4, that's how it works, it's easy to get started.
// Program file Public class program { publicstaticvoid Main (string[] args) { Console.WriteLine ("Hello world! " ); } }
Note: The directory structure is:
d:.│ nuget.config│ program.cs│ project.json│ project.lock.json│├─bin│ └─debug│ └─dnxcore50│ │ Asp. net.dll│ │ ASP. net.pdb│ ││ └─win7-x64│ ASP. Net.deps│ ASP. Net.dll│ ASP. Net.exe│ ASP. net.pdb│ hostpolicy.dll│└─obj └─debug └─dnxcore50 dotnet-compile-csc.rsp dotnet-compile.assemblyinfo.cs dotnet-compile.rsp
Because dotnet new creates a console application, there is only one program file.
If you need to build a WEB application, you need to add the Startup.cs file ( above ) and then use Webhostbuilder to host it in Program.cs.
ASP. NET Core Marching Record-----Camp departure