Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for ASP.NET 5 Beta8 #24

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed AzureTableStorageNLogTarget.1.0.9.nupkg
Binary file not shown.
206 changes: 206 additions & 0 deletions NLog.Extensions.AzureTableStorage.EmptyApplication/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/

# Visual Studio 2015 cache/options directory
.vs/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# DNX
project.lock.json
artifacts/

*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
_NCrunch_*
.*crunch*.local.xml

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config

# Windows Azure Build Output
csx/
*.build.csdef

# Windows Store app package directory
AppPackages/

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/

# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
bower_components/
orleans.codegen.cs

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
*.mdf
*.ldf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings

# Microsoft Fakes
FakesAssemblies/

# Node.js Tools for Visual Studio
.ntvs_analysis.dat

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>87d6bdf5-8313-45be-90ce-d0f8f15c44a9</ProjectGuid>
<RootNamespace>EmptyApplication</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>

<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
30 changes: 30 additions & 0 deletions NLog.Extensions.AzureTableStorage.EmptyApplication/NLog.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog throwsException="true" xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true">

<extensions>
<add assembly="NLog.Extensions.AzureTableStorage"/>
</extensions>

<targets>
<target name="logfile"
xsi:type="File"
deleteOldFileOnStartup="true"
fileName="log.txt"
layout="${longdate} ${level:uppercase=true} ${logger} ${event-context:item=EventId} ${message} ${ndc}" />
<target name="console"
xsi:type="ColoredConsole"
layout="${longdate} ${level:uppercase=true} ${logger} ${event-context:item=EventId} ${message} ${ndc}" />
<target name="AzureTableStorage"
xsi:type="AzureTableStorage"
layout="${longdate} ${level:uppercase=true} ${logger} ${event-context:item=EventId} ${message} ${ndc}"
PartitionKeyPrefix="customPrefix"
connectionStringKey="StorageAccountConnectionString"
tableName="TempAzureTableStorageTargetTestsLogs" />
</targets>

<rules>
<logger name="*" minlevel="Debug" writeTo="logfile,console,AzureTableStorage" />
</rules>
</nlog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:56012/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"Hosting:Environment": "Development"
}
},
"web": {
"commandName": "web",
"environmentVariables": {
"Hosting:Environment": "Development"
}
}
}
}
61 changes: 61 additions & 0 deletions NLog.Extensions.AzureTableStorage.EmptyApplication/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

using System.IO;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.Dnx.Runtime;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.PlatformAbstractions;

namespace NLog.Extensions.AzureTableStorage.EmptyApplication
{
public class Startup
{
private Microsoft.Extensions.Logging.ILogger _log;
private string logConfigurationFile = string.Empty;

public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
{
// Setup configuration sources.

var builder = new ConfigurationBuilder()
.SetBasePath(appEnv.ApplicationBasePath)
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
logConfigurationFile = Path.Combine(appEnv.ApplicationBasePath, "NLog.config");

builder.AddEnvironmentVariables();
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; set; }

public void ConfigureServices(IServiceCollection services)
{
// Configure AtsOption for NLog.Extensions.AzureTableStorage
services.ConfigureAts(options => {
options.StorageAccountConnectionString = Configuration["AppSettings:StorageAccountConnectionString"];
});
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
// add NLog for logging
loggerFactory.AddNLog(new LogFactory(new NLog.Config.XmlLoggingConfiguration(logConfigurationFile)));
_log = loggerFactory.CreateLogger<Startup>();

// generate some log output
_log.LogInformation("Happy table logging!");
_log.LogInformation(string.Format("Log configuration: {0}", logConfigurationFile));

app.UseIISPlatformHandler();

app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"AppSettings": {
"StorageAccountConnectionString": "UseDevelopmentStorage=true"
}
}
37 changes: 37 additions & 0 deletions NLog.Extensions.AzureTableStorage.EmptyApplication/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"version": "1.0.0-*",
"authors": [ "greenliff.com" ],

"tooling": {
"defaultNamespace": "NLog.Extensions.AzureTableStorage.EmptyApplication"
},

"dependencies": {
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final-*",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final-*",
"Microsoft.AspNet.Hosting": "1.0.0-rc1-final-*",
"Microsoft.Dnx.Runtime": "1.0.0-rc1-final-*",
"Microsoft.Extensions.DependencyInjection": "1.0.0-rc1-final-*",
"Microsoft.Extensions.Logging.NLog": "1.0.0-rc1-final-*",
"NLog.Extensions.AzureTableStorage": ""
},

"commands": {
"kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:5004",
"ef": "EntityFramework.Commands",
"web": "Microsoft.AspNet.Server.Kestrel"
},

"frameworks": {
"dnx451": { }
},

"exclude": [
"wwwroot",
"node_modules"
],
"publishExclude": [
"**.user",
"**.vspscc"
]
}
Loading