Import a BACPAC File to Create a New Database

I used a SQL Express 2016 to import a bacpac file from Azure.
(Export the db from the Azure Portal first). And the SQL Server Management studio 17.

Initially imported into SQL Express 2014 but got some warnings/errors regarding the import, so SQL 2016 works better.

Steps:
1. Access to a bacpac file locally / on azure storage
2. Use the UI wizard in Management Studio. (See below)

To launch the wizard, use the following steps:
  1. Connect to the instance of SQL Server, whether on-premise or in SQL Database.
  2. In Object Explorer, right-click on Databases, and then select the Import Data-tier Application menu item to launch the wizard.
  3. Complete the wizard dialogs: Introduction Page. Import Settings Page.

    Source: Import a BACPAC File to Create a New User Database | Microsoft Docs

I got this error when starting up the website:
System.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 – The certificate chain was issued by an authority that is not trusted.

Solved the error by setting TrustServerCertificate=false in the connectionstring.

More info here:
https://stackoverflow.com/questions/17615260/the-certificate-chain-was-issued-by-an-authority-that-is-not-trusted-when-conn

Accessing Azure Web App with FTP

Login to azure portal
https://portal.azure.com/

Goto your web app

Select the tab “Deployment credentials” and set username and password to be used for FTP access. (remember to save).

Goto the “Overview” tab (the top tab)
In the right column you find:

Notice that the user name will be [web app name]\[my username]
That should be all you need to access the web app with ftp or ftps.

 

Download Remote Desktop Connection Manager 2.7 from Official Microsoft Download Center

RDCMan manages multiple remote desktop connections. It is useful for managing server labs or large server farms where you need regular access to each machine such as automated checkin systems and data centers. It is similar to the built-in MMC Remote Desktops snap-in, but more flexible. The RDCMan 2.7 version is a major feature release. New features include: – Virtual machine connect-to-console support – Smart groups – Support for credential encryption with certificates – Windows 8 remote action support – Support for Windows 8, Windows 8.1 / Windows Server 2012, Windows Server 2012 R2

Source: Download Remote Desktop Connection Manager 2.7 from Official Microsoft Download Center

Import existing EPiServer users into an empty database – EPiServer 7.5

Here is a short guide for importing users from an existing EPiServer site into an empty EPiServer site. And then setup the default user groups and access rights. This is for EPiServer 7.5 using the standard Sql Membership but will probably work fine with newer EPiServer versions as well.

Create empty db

Run deployment center as administrator -> select create Sql db.

Importing users from old/other db:

How to copy table data, see this guide: https://www.sqlshack.com/how-to-copy-tables-from-one-database-to-another-in-sql-server/
The tables are named like: aspnet_Applications

Marked in bold are the tables that was used by my EPiServer 7.5 installation (the other tables where just empty). This is the order used, (see the link above), making sure the Users table is uploaded early on is important.

1. Application
2. Users
3.Membership
4.Paths
5.PersonalizationAllUsers
6.PersonalizationPerUser
7.Profile
8.Roles
9.Events
10.UsersInRoles (watch out for FK constraints to Users and Roles)
11.SchemaVersions (identical between same EPiServer db versions)

Create users and roles from scratch

Override the access protection to EPiServer admin until valid admin user and user groups are created:

Find location elements in web.config and comment out:

Comment out the <authorization> element entirely (removes the access protection). The same for location:

Goto http://mysite.local/epi/CMS/Admin/Default.aspx or similar for epi admin area.

Create new roles in admin: (these are EPiServer defaults)
WebEditors
WebAdmins

Add your admin user  to WebEditors and WebAdmins group.

Goto admin “Set access rights”

Set correct access rights for editors and admin groups.
Check lower checkbox to make descendant content inherit the rights.
Also “Everyone” group should have Read access on root and downwards.

Set this in web.config:

PagestartId should be root id.

Uncomment the authorization for /epi and /epi/cms/admin (enable the authorization again).

Login with you admin user
Create a start page or import an episerver export xml file.
Run  [mysite.local]/epi/CMS/Admin/IndexContent.aspx to update search index if imported content.

Goto site settings in admin and point out the page as start page. And/or set in web.config

(usually becomes 4)

Goto site settings in admin and point out the all site hosts (dev, test, prod etc).
Add more users such as editors and adminstrators that need access to site.

Custom error pages in ASP.NET MVC

Excellent blog post by Ben Foster:
Custom error pages in ASP.NET MVC. Easy, right? – Ben Foster

My extra take on it was to create content in the static .html pages and use an iframe inside the aspx based pages (to reuse the content easily).

E.g: (my 500 error page is named Error500.aspx)

 

ASP.NET Core Razor Pages – Simpler ASP.NET MVC Apps with Razor Pages

“Razor Pages are a new feature in ASP.NET Core 2.0. They provide a simpler way to organize code within ASP.NET Core applications, keeping implementation logic and view models closer to the view implementation code. They also offer a simpler way to get started developing ASP.NET Core apps, but that doesn’t mean you should dismiss them if you’re an experienced .NET developer. You can also use Razor Pages to improve the organization of larger and more complex ASP.NET Core apps.”

Source: ASP.NET Core – Simpler ASP.NET MVC Apps with Razor Pages

Architect modern web applications with ASP.NET Core and Azure | Microsoft Docs

.NET Core and ASP.NET Core offer several advantages over traditional .NET development. You should use .NET Core for your server applications if some or all of the following are important to your application’s success:

  • Cross-platform support

  • Use of microservices
  • Use of Docker containers
  • High performance and scalability requirements
  • Side-by-side versioning of .NET versions by application on the same server

PDF:
https://raw.githubusercontent.com/dotnet-architecture/eShopOnWeb/master/docs/Architecting%20Modern%20Web%20Applications%20with%20ASP.NET%20Core%20and%20Azure.pdf

Online: Architect modern web applications with ASP.NET Core and Azure | Microsoft Docs