Things to know ASP.Net Core run as separate unlike classic ASP.Net which run in process of the IIS Worker Process.
ASP.Net Core run in it’s own web server using highly optimised Kestrel component .
ASP.NET Core applications are standalone Console applications invoked through the dotnet runtime command. It uses AspNetCoreModule to execute the external console.
The AspNetCoreModule loades when the first request comes and then routed to your ASP.NET Core application.
Incoming request int the kernel mode http.sys which routes into IIS.
The request is then forwarded to your ASP.NET Core application on the HTTP port,
Kestrel pushes the request into the ASP.NET Core middleware pipeline which then handles your request and HTTP output is then passed back to the IIS.
<?xml version=”1.0″ encoding=”utf-8″?>
<add name=”aspNetCore” path=”*” verb=”*” modules=”AspNetCoreModule” resourceType=”Unspecified” />
<aspNetCore processPath=”dotnet” arguments=”.\WAppCore.dll” stdoutLogEnabled=”false” stdoutLogFile=”.\logs\stdout” />
Note: Check AspNetCoreModule is installed in IIS.
This can be installed using ASP.Net Core SDK
In order to connect your Hyper-V machine with the internet will require virtual network adaptor and sharing internet via wifi network in your laptop.
- Create Virtual adaptor
- Go to Hyper V manager
- Do not select any Hyper-V machine instance
- Select machine name on left pane
- From Action menu select Virtual Switch manager
- Select Internal Only
- From right pane Select Internal
- Press the Create Virtual Switch button
- Enter name of your Virtual Switch
- Check the VLAN ID checkbox
- Click OK to save
- Select the Instance of Hyper-V machine
- Click on settings using right click or from right pane
- Select your Network adaptor from the left pane
- From Right pane
- Select your virtual adaptor from the drop down option created in step -1.8
- Check the VLAN ID check box
- Click OK
- Go to “Control Panel –> Network and Internet –> Network and Sharing Centre”
- Click “Change adaptor settings”
- Go to properties of WIFI adaptor
- Click on Sharing Tab
- Check the allow network users to connect through this computer’s internet connection.
- Click OK.
- Select the virtual LAN created in step-1 from the drop down option
- Select your Virtual Adaptor as created in step-1.8
- Go to Properties
- Double click Internet Protocol Version 4 (TCP/IPv4)
- IP address will default to 192.168.137.1
- under DNS add 220.127.116.11 and 18.104.22.168
For network connection problem click here
ASP.NET Core is initialized from the Startup class in the application
wwwroot folder contains static files (like js, css and image files for our web application).
<link rel=”stylesheet” href=”~/view-resources/Areas/AppAreaName/Views/Users/Index.css” asp-append-version=”true” />
<link rel=”stylesheet” href=”~/view-resources/Areas/AppAreaName/Views/Users/Index.min.css” asp-append-version=”true” />
Below are the commands to setup SPA in ASP.Net Core
dotnet new –install Microsoft.AspNetCore.SpaTemplates::*
dotnet new angular
npm i -g webpack
- npm i webpack-compiler
If are getting error after deploying your ASP.Net Core application in Azure PaaS environment and want to see quick error stack then you need to make change in web.config file
1. Web.config file settings:-
<environmentVariable name=”ASPNETCORE_ENVIRONMENT” value=”Development” />
Also check your appsetting.json file.
Remove user from Office365 Azure Directory
PS C:\Windows\System32> Connect-Msolservice
PS C:\Windows\System32> remove-Msoluser -UserPrincipalName <user-name>@<domain-name>.<com>
Continue with this operation?
[Y] Yes [N] No [S] Suspend [?] Help (default is “Y”): Y
This is code snippet to check if user has role permission
/// Find the particular role definition to check agaionst the user has permisson
SPRoleDefinition roleDefinition = web.RoleDefinitions.GetByType(SPRoleType.Administrator);
SPUser siteUser = web.SiteUsers[“SP\\mukesh”];
///Get all permission for the selected user
SPPermissionInfo userPermissions = web.GetUserEffectivePermissionInfo(siteUser.LoginName);
///Check role is is assigned to the user
var memberof = userPermissions.RoleAssignments.Where(role => role.RoleDefinitionBindings.Contains(roleDefinition)).Select(roleMember => roleMember.Member).ToList();
It’s very common to use object data source to bind the grid , formview etc but the problem is Assembly registration in web.config specially in multi server farm.
In order to avoid the registration of your assembly in web.config file just follow two simple steps as mentioned below.
In your UserControl ASCX file add assembly directive
<%@ Assembly Name=”ILX.MKS.Business, Version=22.214.171.124, Culture=neutral, PublicKeyToken=123a45b9c456789″ %>
In object data source give fully qualified type Name like below
TypeName=”ILX.MKS.Business.UserRegistration, ILX.MKS.Business, Version=126.96.36.199, Culture=neutral, PublicKeyToken=123a45b9c456789″
There are pros and cons of the above option, this is helpful if you do not want to touch the web.config file, otherside is if you maintain in web.config then will be central location to maintain
the assembly reference.