Archive

Archive for the ‘Angular 2’ Category

Publish .NET Core 1.0 site to Azure


I’m working to my first Angular2 site , and now that something is working i tried to publish on Azure.
First lesson learned: if you use ASP.NET Identity copy only the table structures(of AspNetRoles table, AspNetUsers and so on) to Azure SQL , but not the data: use a DbSeeder code in Startup .cs to create the initial set of Users, Roles, etc. otherwise you never get successfully the token.
The deployment is simple, as the normal (not Core) ASP.NET sites: right clic on the project then Deploy.
It is recommended to download from Azure the WebApp publish profile

when publish from Visual Studio (in my case, Vs2015)

In order to simplify the process.
Now the site started, but i got an error:

connecting to http://yourazuresite.scm.azurewebsites.net/DebugConsole i noticed that there are not visible .json files… note that opening the web.config it says:
“Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
Oh well, but the Vs2015 publisher does not copy appsettings.json.. and the Core packages? where are? i should try with Vs2017…
So I created with the scm file manager an empty appsettings.json file and an empty package.json file, copied from my pc the text for both files, changed the connection string in appsettings.json.
Then i launched “npm install” in the scm console, that reloads the missing Core packages.
Finally, the site is working.

Categories: .NET Core, Angular 2, Azure

Angular2 changes


I’m working to a .NET Core site using Angular2, by default at every update to Angular new problems.
This time was easy: before in order to retrieve a textbox in a Typescript file i used

this.userForm.find("email")

Now the syntax has changed, .get instead of .find

this.userForm.get("email")

Categories: .NET Core, Angular 2