Former-commit-id: ea030aff445d0934e0c9b83b55dd3ca3874fc4f7 Former-commit-id: bbb248475858766ca5742047ffe8e28ae04592fdTSXN
parent
f4eaf7baab
commit
8dff46b7fc
@ -0,0 +1,18 @@
|
||||
*.bak
|
||||
*.suo
|
||||
*.db
|
||||
*.db-shm
|
||||
*.db-wal
|
||||
*.user
|
||||
.vs
|
||||
obj
|
||||
Obj
|
||||
bin
|
||||
Bin
|
||||
debug
|
||||
Debug
|
||||
release
|
||||
Release
|
||||
Logs
|
||||
logs
|
||||
node_modules
|
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
|
||||
<PackageReference Include="XmlRpcCore" Version="3.1.2.77" />
|
||||
<PackageReference Include="XmlRpcCS" Version="2.1.1.2" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -0,0 +1,35 @@
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Serilog;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace IoTDameon
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.OutputEncoding = Encoding.UTF8;
|
||||
var config = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json", optional: true)
|
||||
.Build();
|
||||
WebHost.CreateDefaultBuilder(args)
|
||||
.UseConfiguration(config)
|
||||
.ConfigureLogging((c, o) =>
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(config)
|
||||
.WriteTo.Console()
|
||||
.WriteTo.File("logs/log.txt", rollOnFileSizeLimit: true, fileSizeLimitBytes: 100 * 1024 * 1024, rollingInterval: RollingInterval.Infinite)
|
||||
.CreateLogger();
|
||||
o.AddSerilog();
|
||||
})
|
||||
.UseStartup<Startup>()
|
||||
.Build()
|
||||
.Run();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System;
|
||||
|
||||
namespace IoTDameon
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
private readonly string _origins = "AllowAllHeaders";
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddCors(options => options.AddPolicy(_origins,
|
||||
builder =>
|
||||
{
|
||||
builder.SetIsOriginAllowed(o => true).AllowAnyMethod().AllowAnyHeader().AllowCredentials();
|
||||
})
|
||||
);
|
||||
|
||||
services.AddHttpClient();
|
||||
|
||||
services.AddControllersWithViews();
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseExceptionHandler("/Error");
|
||||
}
|
||||
|
||||
string basePath = this.Configuration.GetValue<String>("BasePath", "");
|
||||
|
||||
app.UsePathBase(basePath);
|
||||
|
||||
app.UseCors(_origins);
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"server.urls": "http://*:8003"
|
||||
}
|
After Width: | Height: | Size: 31 KiB |
Loading…
Reference in new issue