Skip to content

Instantly share code, notes, and snippets.

View shirhatti's full-sized avatar

Sourabh Shirhatti shirhatti

View GitHub Profile
@shirhatti
shirhatti / boxstarter.ps1
Last active August 15, 2019 23:08 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Sourabh Shirhatti <[email protected]>
# Last Updated: 2017-12-21
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@shirhatti
shirhatti / connectionclose
Created August 16, 2016 19:51
ANCM returns 200 when framework throws exceptions
.
@shirhatti
shirhatti / Startup.cs
Created August 3, 2016 01:06
Minimal ASP.NET Core to return 404
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
namespace ConsoleApplication
{
public class Startup
{
public void Configure(IApplicationBuilder app) {
app.Run(async (context) =>
@shirhatti
shirhatti / Errors.md
Last active April 27, 2016 21:19
ANCM Error

ANCM Errors

Happy path

Event Logs

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="IIS AspNetCore Module" />
    <EventID Qualifiers="0">1001</EventID>
@shirhatti
shirhatti / service.ps1
Created December 10, 2015 22:59
Create breadcrumb directory for Servicing
$breadcrumbFolder = $env:ALLUSERSPROFILE + '\Microsoft DNX\BreadcrumbStore'
New-Item -Force -Path $breadcrumbFolder -ItemType "Directory"
$ACL = Get-Acl -Path $breadcrumbFolder
# Clear any permissions
$ACL.SetAccessRuleProtection($true, $false)
# Set new permissions
$ACL.SetSecurityDescriptorSddlForm("O:SYG:SYD:P(A;OICI;CCDCSWWPLORC;;;WD)(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)")
Set-Acl -Path $breadcrumbFolder -AclObject $ACL
@shirhatti
shirhatti / gist:83e42592175d93201d4d
Created December 9, 2015 19:44
Docfx stack trace on Ubuntu 14.04 and Mono 4.0.5
Error: Error running program: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
at System.Reflection.Assembly+<>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[System.Reflection.TypeInfo,System.Type].MoveNext () [0x00000] in <filename unknown>:0
at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator12`2[System.Reflection.Assembly,System.Type].MoveNext () [0x00000] in <filename unknown>:0
at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor (IEnumerable`1 types, System.Composition.Convention.AttributedModelProvider attributeContext) [0x00000] in <filename unknown>:0
at System.Composition.Hosting.ContainerConfiguration.CreateContainer () [0x00000] in <filename unknown>:0
at Micro
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName": {
"type": "string",
"metadata": {
"description": "Name of storage account"
}
},
@shirhatti
shirhatti / guide.md
Last active July 8, 2019 03:15
Publish to a Linux Production Environment

Publish to a Linux Production Environment

In this guide, we will cover setting up a production-ready ASP.NET environment on an Ubuntu 14.04 Server. Though we will cover the specifics of using Ubuntu 14.04, the content will be applicable to other flavors of Linux.

We will take an existing ASP.NET 5 application and place it behind a reverse-proxy server. We will then setup the reverse-proxy server to forward requests to our Kestrel web server.

Additionally we will write a startup script to ensure our web application runs on startup as a daemon as well as a configure a process management tool to help restart our web application in the event of a crash to guarantee high availibility.

Prerequisites

@shirhatti
shirhatti / dnvm.sh
Created August 26, 2015 21:11
Install Dot Net Version Manager
sudo apt-get install unzip
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
# Copyright (c) .NET Foundation
# Licensed under the MIT License
author "Sourabh Shirhatti"
start on runlevel [2345]
stop on runlevel [016]
script
exec start-stop-daemon --start --make-pidfile --pidfile /var/run/aspnet5webserver.pid --chuid aspnet --exec /home/shirhatti/.dnx/runtimes/dnx-mono.1.0.0-beta6/bin/dnx /home/shirhatti/output/approot/src/WebApplicationBasic/ kestrel >> /var/log/aspnet5webserver.sys.log 2>&1
end script