GithubHelp home page GithubHelp logo

trilonio / aspnetcore-angular-universal Goto Github PK

View Code? Open in Web Editor NEW
1.5K 163.0 433.0 5.62 MB

ASP.NET Core & Angular Universal advanced starter - PWA w/ server-side rendering for SEO, Bootstrap, i18n internationalization, TypeScript, unit testing, WebAPI REST setup, SignalR, Swagger docs, and more! By @TrilonIO

Home Page: https://www.trilon.io

License: MIT License

TypeScript 33.97% CSS 6.81% HTML 14.34% C# 21.93% JavaScript 21.85% Dockerfile 1.09%
angular universal ngrx hmr aspnetcore aspnet ssr angular2 dotnet-template angular4 angular5 angular6 trilon

aspnetcore-angular-universal's Introduction

ASP.NET Core 2.1 & Angular 7(+) Advanced Starter - PWA & Server-side prerendering (for Angular SEO)!



Trilon.io - Angular Universal, NestJS, JavaScript Application Consulting Development and Training

Made with ❤️ by Trilon.io


Harness the power of Angular 7+, ASP.NET Core 2.1, now with SEO !

Angular SEO in action:

ASP.NET Core Angular7 SEO

Angular Universal Application Architecture

ASP.NET Core 2.1 Angular 7+ Starter

This repository is maintained by Trilon.io and the Angular Universal team and is meant to be an advanced starter for both ASP.NET Core 2.1 using Angular 7.0+, not only for the client-side, but to be rendered on the server for instant application paints (Note: If you don't need SSR read here on how to disable it).

This is meant to be a Feature-Rich Starter application containing all of the latest technologies, best build systems available, and include many real-world examples and libraries needed in todays Single Page Applications (SPAs).

This utilizes all the latest standards, no gulp, no bower, no typings, no manually "building" anything. NPM, Webpack and .NET handle everything for you!

Join us on Gitter

Gitter chat

Table of Contents


Features:

These are just some of the features found in this starter!

  • ASP.NET 2.1 - VS2017 support now!

    • Azure delpoyment straight from VS2017
    • Built in docker support through VS2017
    • RestAPI (WebAPI) integration
    • SQL Database CRUD demo
    • Swagger WebAPI documentation when running in development mode
    • SignalR Chat demo! (Thanks to @hakonamatata)
  • Angular 7.0.0 :

    • PWA (Progressive Web App)
    • (Minimal) Angular-CLI integration
      • This is to be used mainly for Generating Components/Services/etc.
      • Usage examples:
        • ng g c components/example-component
        • ng g s shared/some-service
    • Featuring Server-side rendering (Platform-Server, aka: "Universal")
      • Faster initial paints, SEO (Search-engine optimization w Title/Meta/Link tags), social media link-previews, etc
    • i18n internationalization support (via/ ngx-translate)
    • Baked in best-practices (follows Angular style guide)
    • Bootstrap3 (with ngx-bootstrap) - (can be rendered on the server!)
      • Can be easily replaced with bootstrap4 (3 is provided for browser support)
      • Bootstrap using SCSS / SASS for easy theming / styling!
  • Webpack build system (Webpack 4)

    • HMR : Hot Module Reloading/Replacement
    • Production builds w/ AoT Compilation
  • Testing frameworks

    • Unit testing with Jest (Going back to Karma soon)
  • Productivity

    • Typescript 2
    • Codelyzer (for Real-time static code analysis)
      • VSCode & Atom provide real-time analysis out of the box.
  • ASP.NET Core 2.1

    • Integration with NodeJS to provide pre-rendering, as well as any other Node module asset you want to use.
  • Azure

    • Microsoft Application Insights setup (for MVC & Web API routing)
    • Client-side Angular Application Insights integration
        // Add the Module to your imports 
        ApplicationInsightsModule.forRoot({
          instrumentationKey: 'Your-Application-Insights-instrumentationKey'
        })
  • Docker

    • Built in Visual Studio F5 Debugging support
    • Uses the very light weight microsoft/dotnet image
    • Currently limited to Linux image as there is a bug with running nodejs in a container on Windows.


Getting Started?

  • Make sure you have at least Node 8.11.1 or higher (w/ npm 5+) installed!
  • This repository uses ASP.Net Core 2.1, which has a hard requirement on .NET Core Runtime 2.1 and .NET Core SDK 2.1. Please install these items from here

Visual Studio 2017

Make sure you have .NET Core 2.1 installed and/or VS2017 15.3. VS2017 will automatically install all the neccessary npm & .NET dependencies when you open the project.

Simply push F5 to start debugging !

Docker-Support: Change the startup project to docker-compose and press F5

Note: If you get any errors after this such as module not found: boot.server (or similar), open up command line and run npm run build:dev to make sure all the assets have been properly built by Webpack.

Visual Studio Code

Note: Make sure you have the C# extension & .NET Core Debugger installed.

The project comes with the configured Launch.json files to let you just push F5 to start the project.

# cd into the directory you cloned the project into
npm install && npm run build:dev && dotnet restore
# or yarn install

If you're running the project from command line with dotnet run make sure you set your environment variables to Development (otherwise things like HMR might not work).

# on Windows:
set ASPNETCORE_ENVIRONMENT=Development
# on Mac/Linux
export ASPNETCORE_ENVIRONMENT=Development 

Upcoming Features:

  • Clean API / structure / simplify application
  • Refactor to latest RxJs pipeable syntax
  • Attempt to integrate with Angular-CLI fully


Deployment

Dotnet publish

Using dotnet publish, when it's finished place the generated folder onto your server and use IIS to fire everything up.

Heroku

Deploy on Heroku

Azure

git remote add azure https://[email protected]:443/my-angular2-site.git
                     // ^ get this from Azure (Web App Overview section - Git clone url)

git push --set-upstream azure master 

Application Structure:

Note: This application has WebAPI (our REST API) setup inside the same project, but of course all of this could be abstracted out into a completely separate project('s) ideally. .NET Core things are all done in the same project for simplicity's sake.

Root level files

Here we have the usual suspects found at the root level.

Front-end oriented files:

  • package.json - NPM project dependencies & scripts
  • .tsconfig - TypeScript configuration (here we setup PATHs as well)
  • webpack - configuration files (modular bundling + so much more)
  • karma - configuration files (unit testing)
  • protractor - config files (e2e testing)
  • tslint - TypeScript code linting rules

/ClientApp/ - Everything Angular

Let's take a look at how this is structured so we can make some sense of it all!

With Angular Universal, we need to split our applicatoin logic per platform so if we look inside this folder, you'll see the 2 root files, that branch the entire logic for browser & server respectively.

  • Boot.Browser.ts - This file starts up the entire Angular application for the Client/browser platform.

Here we setup a few things, client Angular bootstrapping.

You'll barely need to touch this file, but something to note, this is the file where you would import libraries that you only want being used in the Browser. (Just know that you'd have to provide a mock implementation for the Server when doing that).

  • Boot.Server.ts - This file is where Angular platform-server serializes the Angular application itself on the .NET server within a very quick Node process, and renders it a string. This is what causes that initial fast paint of the entire application to the Browser, and helps us get all our SEO goodness ✨

Notice the folder structure here in ./ClientApp/ :

+ /ClientApp/

+   /app/
    App NgModule - our Root NgModule (you'll insert Components/etc here most often)
    AppComponent / App Routes / global css styles

    * Notice that we have 2 dividing NgModules:
        app.module.browser & app.module.server
    You'll almost always be using the common app.module, but these 2 are used to split up platform logic
    for situations where you need to use Dependency Injection / etc, between platforms.

Note: You could use whatever folder conventions you'd like, I prefer to split up things in terms of whether they are re-usable 
     "components" or routeable / page-like components that group together and organize entire sections.
++ > ++ > /components/ 
          Here are all the regular Components that aren't "Pages" or container Components

++ > ++ > /containers/
          These are the routeable or "Page / Container" Components, sometimes known as "Dumb" Components

++ > ++ > /shared/
          Here we put all shared Services / Directives / Pipes etc

When adding new features/components/etc to your application you'll be commonly adding things to the Root NgModule (located in /ClientApp/app/app.module.ts), but why are there two other NgModules in this folder?

This is because we want to split our logic per Platform, but notice they both share the Common NgModule named app.module.ts. When adding most things to your application, this is the only place you'll have to add in your new Component / Directive / Pipe / etc. You'll only occassional need to manually add in the Platform specific things to either app.module.browser || app.module.server.

To illustrate this point with an example, you can see how we're using Dependency Injection to inject a StorageService that is different for the Browser & Server.

// For the Browser (app.module.browser)
{ provide: StorageService, useClass: BrowserStorage }

// For the Server (app.module.server)
{ provide: StorageService, useClass: ServerStorage }

Just remember, you'll usually only need to worry about app.module.ts, as that's where you'll be adding most of your applications new aspects!

/Server/ - Our REST API (WebApi) - MVC Controller

As we pointed out, these are here for simplicities sake, and realistically you may want separate projects for all your microservices / REST API projects / etc.

We're utilizing MVC within this application, but we only need & have ONE Controller, named HomeController. This is where our entire Angular application gets serialized into a String, sent to the Browser, along with all the assets it needs to then bootstrap on the client-side, and become a full-blown SPA afterwards.


The short-version is that we invoke that Node process, passing in our Request object & invoke the boot.server file, and we get back a nice object that we pass into .NETs ViewData object, and sprinkle through out our Views/Shared/_Layout.cshtml and /Views/Home/index.cshtml files!

A more detailed explanation can be found here: ng-AspnetCore-Engine Readme

// Prerender / Serialize application
var prerenderResult = await Prerenderer.RenderToString(
    /* all of our parameters / options / boot.server file / customData object goes here */
);

ViewData["SpaHtml"] = prerenderResult.Html;
ViewData["Title"] = prerenderResult.Globals["title"];
ViewData["Styles"] = prerenderResult.Globals["styles"];
ViewData["Meta"] = prerenderResult.Globals["meta"];
ViewData["Links"] = prerenderResult.Globals["links"];

return View(); // let's render the MVC View

Take a look at the _Layout.cshtml file for example, notice how we let .NET handle and inject all our SEO magic (that we extracted from Angular itself) !

<!DOCTYPE html>
<html>
    <head>
        <base href="/" />
        <!-- Title will be the one you set in your Angular application -->
        <title>@ViewData["Title"] - AspNET.Core Angular 7.0.0 (+) starter</title>

        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        @Html.Raw(ViewData["Meta"]) <!-- <meta /> tags -->
        @Html.Raw(ViewData["Links"]) <!-- <link /> tags -->
        
        <link rel="stylesheet" href="~/dist/vendor.css" asp-append-version="true" />

        @Html.Raw(ViewData["Styles"]) <!-- <style /> tags -->

    </head>
    ... etc ...

Our Views/Home/index.cshtml simply renders the application and serves the bundled webpack files in it.

@Html.Raw(ViewData["SpaHtml"])

<script src="~/dist/vendor.js" asp-append-version="true"></script>
@section scripts {
    <script src="~/dist/main-client.js" asp-append-version="true"></script>
}

What happens after the App gets server rendered?

Well now, your Client-side Angular will take over, and you'll have a fully functioning SPA. (But we gained all these great SEO benefits of being server-rendered) !



"Gotchas"

  • This repository uses ASP.Net Core 2.1, which has a hard requirement on .NET Core Runtime 2.1 and .NET Core SDK 2.1. Please install these items from here

When building components in Angular 7 there are a few things to keep in mind.

  • Make sure you provide Absolute URLs when calling any APIs. (The server can't understand relative paths, so /api/whatever will fail).

  • API calls will be ran during a server, and once again during the client render, so make sure you're using transfering data that's important to you so that you don't see a flicker.

  • window, document, navigator, and other browser types - do not exist on the server - so using them, or any library that uses them (jQuery for example) will not work. You do have some options, if you truly need some of this functionality:

    • If you need to use them, consider limiting them to only your client and wrapping them situationally. You can use the Object injected using the PLATFORM_ID token to check whether the current platform is browser or server.
     import { PLATFORM_ID } from '@angular/core';
     import { isPlatformBrowser, isPlatformServer } from '@angular/common';
     
     constructor(@Inject(PLATFORM_ID) private platformId: Object) { ... }
     
     ngOnInit() {
       if (isPlatformBrowser(this.platformId)) {
          // Client only code.
          ...
       }
       if (isPlatformServer(this.platformId)) {
         // Server only code.
         ...
       }
     }
    • Try to limit or avoid using setTimeout. It will slow down the server-side rendering process. Make sure to remove them ngOnDestroy in Components.
    • Also for RxJs timeouts, make sure to cancel their stream on success, for they can slow down rendering as well.
  • Don't manipulate the nativeElement directly. Use the Renderer2. We do this to ensure that in any environment we're able to change our view.

constructor(element: ElementRef, renderer: Renderer2) {
  this.renderer.setStyle(element.nativeElement, 'font-size', 'x-large');
}
  • The application runs XHR requests on the server & once again on the Client-side (when the application bootstraps)
    • Use a cache that's transferred from server to client (TODO: Point to the example)
  • Know the difference between attributes and properties in relation to the DOM.
  • Keep your directives stateless as much as possible. For stateful directives, you may need to provide an attribute that reflects the corresponding property with an initial string value such as url in img tag. For our native element the src attribute is reflected as the src property of the element type HTMLImageElement.
  • Error: sass-loader requires node-sass >=4: Either in the docker container or localhost run npm rebuild node-sass -f


FAQ - Also check out the !FAQ Issues label! and the !HOW-TO Issues Label!

How can I disable SSR (Server-side rendering)?

Simply comment out the logic within HomeController, and replace @Html.Raw(ViewData["SpaHtml"]) with just your applications root AppComponent tag ("app-root" in our case): <app-root></app-root>.

You could also remove any isPlatformBrowser/etc logic, and delete the boot.server, app.module.browser & app.module.server files, just make sure your boot.browser file points to app.module.

How do I have code run only in the Browser?

Check the Gotchas on how to use isPlatformBrowser().

How do I Material2 with this repo?

You'll either want to remove SSR for now, or wait as support should be coming to handle platform-server rendering. This is now possible, with the recently updated Angular Material changes. We do not have a tutorial available for this yet.

How can I use jQuery and/or some jQuery plugins with this repo?

Note: If at all possible, try to avoid using jQuery or libraries dependent on it, as there are better, more abstract ways of dealing with the DOM in Angular (5+) such as using the Renderer, etc.

Yes, of course but there are a few things you need to setup before doing this. First, make sure jQuery is included in webpack vendor file, and that you have a webpack Plugin setup for it. new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' })

Now, make sure any "plugins" etc that you have, are only included in your boot.browser.ts file. (ie: import 'slick-carousel';) In a Component you want to use jQuery, make sure to import it near the top like so:

import * as $ from 'jquery';

Always make sure to wrap anything jQuery oriented in Angular's isPlatformBrowser() conditional!

How can I support IE9 through IE11?

To support IE9 through IE11 open the polyfills.ts file in the polyfills folder and uncomment out the 'import polyfills' as needed. ALSO - make sure that your webpack.config and webpack.config.vendor change option of TerserPlugin from ecma: 6 to ecma: 5.


Special Thanks

Many thanks go out to Steve Sanderson (@SteveSandersonMS) from Microsoft and his amazing work on JavaScriptServices and integrating the world of Node with ASP.NET Core.

Also thank you to the many Contributors !


Found a Bug? Want to Contribute?

Check out our easier issues here

Nothing's ever perfect, but please let me know by creating an issue (make sure there isn't an existing one about it already), and we'll try and work out a fix for it! If you have any good ideas, or want to contribute, feel free to either make an Issue with the Proposal, or just make a PR from your Fork.


License

MIT License

Copyright (c) 2016-2019 Mark Pieszak

Twitter Follow


Trilon - Angular & ASP.NET - Consulting | Training | Development

Check out Trilon.io for more info! Twitter @Trilon_io

Contact us at [email protected], and let's talk about your projects needs.

Trilon.io - Angular Universal, NestJS, JavaScript Application Consulting Development and Training

Follow Trilon online:

Twitter: @Trilon_io

aspnetcore-angular-universal's People

Contributors

abrarjahin avatar adondriel avatar cygnim avatar davidsekar avatar emkialton avatar gaulomatic avatar grimmr3ap3r avatar hakonamatata avatar info-lvsys avatar isaac2004 avatar isaacrlevin avatar jamescoffman23 avatar liverpoolowen avatar mapleye avatar markoj21 avatar markpieszak avatar markwhitfeld avatar mikeysteele avatar nalex095 avatar nemad avatar oceansidebill avatar oruban avatar paonath avatar peterblazejewicz avatar peterdobson avatar ruant avatar stephenredd avatar stevenjsmith avatar timharker avatar tommylcox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aspnetcore-angular-universal's Issues

[bug] sln cannot be opened in vs2017RC (xproj)

after the suggested upgrading this is shown:

Angular2Spa.xproj: Failed to migrate XProj project Angular2Spa. 'dotnet migrate --skip-backup -s -p "C:\Dropbox\projects_github\aspnetcore-angular2-universal" -x "C:\Dropbox\projects_github\aspnetcore-angular2-universal\Angular2Spa.xproj"' exited with error code 1.
Angular2Spa.xproj: No executable found matching command "dotnet-migrate"

also the project.json/xproj has to be migrated to the new csproj structure.

Exception: Call to Node module failed with error: reflect-metadata shim is required when using class decorators

Hello,

Get an error:

screen shot 2016-11-17 at 7 12 54 pm

but It's ok to use webpack build:
screen shot 2016-11-17 at 7 12 49 pm

The project's npm dependices restoring output:
screen shot 2016-11-17 at 7 21 51 pm

Environment
npm -v
3.8.2

node -v
v4.4.1

Exception Stack
Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor:Information: Executing ViewResult, running view at path /Views/Home/Index.cshtml.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Users\darkl.nuget\packages\Microsoft.AspNetCore.WebUtilities\1.0.0\lib\netstandard1.3\Microsoft.AspNetCore.WebUtilities.dll'. Loading disabled by Include/Exclude setting.
Microsoft.Extensions.DependencyInjection.DataProtectionServices:Information: User profile is available. Using 'C:\Users\darkl\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.1\System.Reflection.Emit.dll'. Loading disabled by Include/Exclude setting.
Microsoft.AspNetCore.NodeServices:Information: Node will restart because file changed: F:\git\aspnetcore-angular2-universal\wwwroot\dist\main.js
Microsoft.AspNetCore.NodeServices:Information: webpack built 396559ce6e3756fbe2a7 in 9638ms
Microsoft.AspNetCore.NodeServices:Information: [default] Checking started in a separate process...
Microsoft.AspNetCore.NodeServices:Information: [default] Ok, 5.798 sec.
Exception thrown: 'System.ArgumentNullException' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in Microsoft.AspNetCore.NodeServices.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in Microsoft.AspNetCore.Mvc.Core.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in Microsoft.AspNetCore.Mvc.Core.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.1\System.Diagnostics.StackTrace.dll'. Loading disabled by Include/Exclude setting.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.1\System.IO.MemoryMappedFiles.dll'. Loading disabled by Include/Exclude setting.
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.ni.dll
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.1\System.IO.UnmanagedMemoryStream.dll'. Loading disabled by Include/Exclude setting.
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware:Error: An unhandled exception has occurred while executing the request

System.Exception: Call to Node module failed with error: reflect-metadata shim is required when using class decorators
at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.d__71.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.d__131.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.d__101.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.d__33.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at AspNetCore._Views_Home_Index_cshtml.d__32.MoveNext() in /Views/Home/Index.cshtml:line 2
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.ViewResult.d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__32.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__31.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__29.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.RouterMiddleware.d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.AspNetCore.SpaServices.Webpack.ConditionalProxyMiddleware.d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.d__6.MoveNext()
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 17725.885ms 500 text/html; charset=utf-8

Vendor.css file is not generated

Hi, I have cloned this repo and started with VS 2015 with Node.JS.

I think I am not getting the output it supposed to be.

I am getting-

"./vendor/vendor.css" not found

Error

Can anyone please help?

Add Material design 2 example

I try to use your template, and change the ng2-bootstrap with the material2 but I always get an error. Can you add the sample for material2

Use of a component which needs 'core-js'

Hi,

I added the "angular2-tree-component" component via npm and got the error "TS2688: Cannot find type definition file for 'core-js'.

After installing "@types\core-js" I got "TS2300: Duplicate identifier 'PropertyKey'" (lib.es2015.core.d.ts).

Has anyone an idea how I can fix that problem?

Pass NgRx State from Server -> Client

Currently we have NgRx Store on the Server, but we need to pass these easily to the client, then initialize the Store with those values. This way if someone uses the Store to handle a lot of their application they can transfer cache/state here instead.

This is another option as opposed to HttpCacheService.

(Could be connected with ngrx/store#294)

I had some issues with tslint

Hi,

I have a some issues with tslint:

The Log after run lint script:

info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'lint' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prelint', 'lint', 'postlint' ]
5 info lifecycle aspnetcore-angular2-universal-starter@~prelint: aspnetcore-angular2-universal-starter@
6 silly lifecycle aspnetcore-angular2-universal-starter@~prelint: no script for prelint, continuing
7 info lifecycle aspnetcore-angular2-universal-starter@~lint: aspnetcore-angular2-universal-starter@
8 verbose lifecycle aspnetcore-angular2-universal-starter@~lint: unsafe-perm in lifecycle true
9 verbose lifecycle aspnetcore-angular2-universal-starter@~lint: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\PROJECTS\ARTYCO\CRM\Presentation\node_modules.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Skype\Phone;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio;C:\NugetCLI;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\130\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\dotnet;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Users\jgarcia.perez\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\jgarcia.perez\AppData\Roaming\npm
10 verbose lifecycle aspnetcore-angular2-universal-starter@~lint: CWD: C:\PROJECTS\ARTYCO\CRM\Presentation
11 silly lifecycle aspnetcore-angular2-universal-starter@~lint: Args: [ '/d /s /c', 'npm run tslint "Client//*.ts"' ]
12 silly lifecycle aspnetcore-angular2-universal-starter@~lint: Returned: code: 1 signal: null
13 info lifecycle aspnetcore-angular2-universal-starter@~lint: Failed to exec lint script
14 verbose stack Error: aspnetcore-angular2-universal-starter@ lint: npm run tslint "Client/**/*.ts"
14 verbose stack Exit status 1
14 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:885:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid aspnetcore-angular2-universal-starter@
16 verbose cwd C:\PROJECTS\ARTYCO\CRM\Presentation
17 error Windows_NT 10.0.14393
18 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "lint"
19 error node v7.4.0
20 error npm v4.0.5
21 error code ELIFECYCLE
22 error aspnetcore-angular2-universal-starter@ lint: npm run tslint "Client/**/*.ts"
22 error Exit status 1
23 error Failed at the aspnetcore-angular2-universal-starter@ lint script 'npm run tslint "Client/
/.ts"'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the aspnetcore-angular2-universal-starter package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error npm run tslint "Client/**/
.ts"
23 error You can get information on how to open an issue for this project with:
23 error npm bugs aspnetcore-angular2-universal-starter
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls aspnetcore-angular2-universal-starter
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Showcase Angular Title service

Show how we can automatically update it through data within a Route.

Updated Root App Component, subscribing to NavigationEnd event and changing Title through MetaService when route finishes changing.

Currently only works in Browser, as we're not supplying the entire Html document. We'll have to look into fixing this later.

import { Component, ViewEncapsulation, Inject, OnInit, OnDestroy } from '@angular/core';
import { Router, NavigationEnd, ActivatedRoute, PRIMARY_OUTLET } from '@angular/router';
import { Title } from '@angular/platform-browser';
import { Subscription } from 'rxjs/Subscription';
import { isBrowser } from 'angular2-universal';
import { Meta } from 'app-shared';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/filter';

@Component({
    selector: 'app-root',
    template: `
        <div class="container-fluid">
            <app-nav-menu></app-nav-menu>
            <router-outlet></router-outlet>
        </div>
    `,
    styleUrls: ['./app.component.css'],
    encapsulation: ViewEncapsulation.None
})
export class AppComponent implements OnInit, OnDestroy {

    private defaultPageTitle: string = 'Angular Universal & ASP.NET Core Starter';
    private sub: Subscription;
  
    constructor(
        public router: Router,
        public activatedRoute: ActivatedRoute,
        public meta: Meta
    ) {}
    
    ngOnInit() {
        // Change "Title" on every navigationEnd event
        // Titles come from the data.title property on all Routes (see app.routes.ts)
        this.changeTitleOnNavigation();
    }
    
    ngOnDestroy() {
        // Subscription clean-up
        this.sub.unsubscribe();
    }

    private changeTitleOnNavigation () {
        this.sub = this.router.events
            .filter(event => event instanceof NavigationEnd)
            .map(() => this.activatedRoute)
            .map(route => {
                while (route.firstChild) route = route.firstChild;
                return route;
            })
            .filter(route => route.outlet === 'primary')
            .mergeMap(route => route.data)
            .subscribe((event) => {

                // Set Title if available, otherwise leave the default Title
                const title = event['title'] 
                    ? (event['title'] + ' - ' + this.defaultPageTitle)
                    : this.defaultPageTitle;

                // Temporarily only do this in the Browser
                // Until we can get entire Html doc (this is a .NET issue since we never pass the entire Document (only root-app))
                return isBrowser ? this.meta.setTitle(event['title']) : '';
            });
    }

}

Showcase lazy loading

Note: Currently unavailable in Universal repo (if that page is initially hit, or refresh is his on it)

[proposal] Make architecture picture a bit cleaner

The subject of my proposal is this picture (browser block).

For me it was very easy to understand how universal is working except html hydration part. As described in docs Angular Universal does not support full hydration from html. The word "hydration" does not appear in the docs at all. Also preboot's repo readme separates hydration from simple re-rendering which universal uses.

As far as I know for now universal supports only object catching.

I think it would be better to replace word "Hydrate" with another one which suits better for case described above.

What are your thoughts on this?

Update instructions

Before I think of using this, I would like to know how I can maintain the newest updates from the repository.

Should I fork the repo and merge every time the updates of this repo to my repo or is there an other update mechanism I don't know about? If yes, you could add this to the readme :).

Thanks in advance.

Server side rendering: incorrect generated HTML

Your server side logic in "bootstrap-server.ts" is rendering a full HTML document inside your Razor template. If your disable Javascript inside your browser and you render the page, you're ending up with something like this:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>.NET Core + Angular + Universal ! - Angular2 ASPNET Core - Starter</title>
        <base href="/" />
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
    <app>
        <!DOCTYPE html><html><head><title></title>...
    </app>
   </body>
</html>

Some examples of Unit Testing would be necessary.

Hi,

Maybe it's something I'm doing wrong with my tests, but when I run "karma" I get errors with the use of JavaScript ES6 +: let.

Log of some errors:

  1. JavaScript ES6 +: let

> [default] Checking started in a separate process...
> Chrome 55.0.2883 (Windows 10 0.0.0) ERROR
>   Uncaught Error: Module parse failed: C:\PROJECTS\ARTYCO\CRM\Presentation\Client\containers\customers\customer-list.component.spec.ts Unexpected token (24:13)
>   You may need an appropriate loader to handle this file type.
>   |    describe('CustomerListComponent:', () => {
>   |       
>   |      let comp: BannerComponent;
>   |      let fixture: ComponentFixture<BannerComponent>;
>   |      let de: DebugElement;
>   at Client/karma-tests.ts:2234
> [default] Ok, 1.105 sec._

  1. When mock Http

> [default] Checking started in a separate process...
> Chrome 55.0.2883 (Windows 10 0.0.0) ERROR
>   Uncaught Error: Module parse failed: C:\PROJECTS\ARTYCO\CRM\Presentation\Client\containers\customers\customer-list.component.spec.ts Unexpected token (32:39)
>   You may need an appropriate loader to handle this file type.
>   |               {
>   |                   provide: Http,
>   |                   useFactory: (pBackend: MockBackend, pOptions: BaseRequestOptions) => {
>   |                       return new Http(pBackend, pOptions);
>   |                   },
>   at Client/karma-tests.ts:2234
> [default] Ok, 0.985 sec.

Also, It will help an example of unit test for "rest-test.component" and some edit form.

If the component has depencies with some service, http, rxjs and use mocks, it will be perfect.

Regards!

main.js not available

what can be the cause if main.js is not available in .\dist?
keep getting 404's on that important file. dotnet ran fine.

Add VSCode Dev & Prod launch options

Once setting set ASPNETCORE_ENVIRONMENT=Production in command line, you must run webpack manually (at the moment at least), then you can Launch the [Production] Launch Web option from VSCode to see the Production version. (Note, HMR etc is off in prod mode of course.)

[proposal] Adding webRTC example

I think adding WebRTC example will be helpful for enriching this template.

I am working on adding WebRTC ( https://webrtc.org/ ) to this library.

If you agree to add webRTC to this library, I proudly like to contribute here :)

Add websockets demo

Issue with VStudio, port setup not wiring up.
Add better Redux/Eventing example on server side.

[feature] Request to add REST API example with Entity Framework

I like to add a simple CRUD REST API with Entity framework in this template.

I like to use SQLite as DB because it is portable and no configuration issue is needed to be faced.

Add after doing that, I like to make a PR.

Will you appreciate to add a REST API with entity framework here and merge that?

Thanks

You need to include some adapter that implements __karma__.start method!

Hi,

I have some problems executing the comand npm “karma start”:

karma start

npm : keywords if/then/else require v5 option

_[33m10 01 2017 18:11:06.625:WARN [karma]: _[39mNo captured browser, open http://localhost:9876/
_[32m10 01 2017 18:11:06.634:INFO [karma]: _[39mKarma v1.3.0 server started at http://localhost:9876/
_[32m10 01 2017 18:11:35.871:INFO [Chrome 55.0.2883 (Windows 10 0.0.0)]: _[39mConnected on socket /#-kYKd2-8muD341jcAAAA with id manual-7585

Chrome 55.0.2883 (Windows 10 0.0.0) ERROR
You need to include some adapter that implements __karma__.start method!

Update CSS for bootstrap4 & fix ng2-bootstrap API changes

Add bootstrap4-alpha7 CSS to layout.

Fix Ng2-bootstrap issues with latest version:

Now imported like:
import { Ng2BootstrapModule } from 'ng2-bootstrap';
Previously:
import { Ng2BootstrapModule } from 'ng2-bootstrap/ng2-bootstrap';

Also needs to be called with Ng2BootstrapModule.forRoot() now.
Updates will be in app.common.ts

Exception: Call to Node module failed with error: reflect-metadata shim is required when using class decorators

Exception details

Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware:Error: An unhandled exception has occurred while executing the request

System.Exception: Call to Node module failed with error: reflect-metadata shim is required when using class decorators
at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.d__71.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.d__131.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.d__101.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.d__33.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at AspNetCore._Views_Home_Index_cshtml.d__32.MoveNext() in /Views/Home/Index.cshtml:line 2
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.ViewResult.d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__32.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__31.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__29.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.RouterMiddleware.d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.AspNetCore.SpaServices.Webpack.ConditionalProxyMiddleware.d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.d__6.MoveNext()
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 17177.3487ms 500 text/html; charset=utf-8
Microsoft.AspNetCore.NodeServices:Information: [default] Ok, 5.185 sec.

reflect-metadata shim is required when using class decorators

Hi there,

I get the exception below when I try running the application (VS2015 update 3). Tried importing es6-shim package, but the error persists.

System.Exception: Call to Node module failed with error: reflect-metadata shim is required when using class decorators at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.<InvokeExportAsync>d__7 1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.<InvokeExportAsync>d__13 1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__10 1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.<ProcessAsync>d__33.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at AspNetCore._Views_Home_Index_cshtml.<ExecuteAsync>d__32.MoveNext() in /Views/Home/Index.cshtml:line 2 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Razor.RazorView.<RenderPageAsync>d__14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Razor.RazorView.<RenderAsync>d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.<ExecuteAsync>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.ViewResult.<ExecuteResultAsync>d__26.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeResultAsync>d__30.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResultFilterAsync>d__28.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResultExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResourceFilter>d__22.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResourceExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__20.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.SpaServices.Webpack.ConditionalProxyMiddleware.<Invoke>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.SpaServices.Webpack.ConditionalProxyMiddleware.<Invoke>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()

Add ASP.NET View Template

Hi,

Can you please add a sample on loading ASP.NET View as template, with server rendering feature

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.