|
|
|
|
@ -3,6 +3,8 @@ |
|
|
|
|
using System.Collections.Concurrent; |
|
|
|
|
using System.ComponentModel; |
|
|
|
|
using System.Diagnostics; |
|
|
|
|
using EmbedIO; |
|
|
|
|
using EmbedIO.Files; |
|
|
|
|
using Microsoft.Data.Sqlite; |
|
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
|
using Microsoft.EntityFrameworkCore.Infrastructure; |
|
|
|
|
@ -221,7 +223,7 @@ using (var db = GetDB()) |
|
|
|
|
//var t1 = ProduceAsync(); |
|
|
|
|
//var t2 = ConsumeAsync(); |
|
|
|
|
//Task.WaitAll(t1, t2); |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
using (var ctx = new AppDbContext()) |
|
|
|
|
{ |
|
|
|
|
ctx.Database.EnsureCreated(); |
|
|
|
|
@ -247,7 +249,7 @@ var builder = new DbContextOptionsBuilder<AppDbContext>(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Console.WriteLine($"{(DateTime.Now - b).TotalSeconds}"); |
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
/* |
|
|
|
|
var copy_obj = await QueryLiveData(); |
|
|
|
|
copy_obj.Id = ObjectId.GenerateNewId().ToString(); |
|
|
|
|
@ -293,3 +295,25 @@ using (var db = GetDB()) |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
async Task OnMappingFailed(IHttpContext context, MappedResourceInfo? info) |
|
|
|
|
{ |
|
|
|
|
context.Redirect("/"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
using (var server = new WebServer(HttpListenerMode.EmbedIO, "http://*:9090")) |
|
|
|
|
{ |
|
|
|
|
server.WithLocalSessionManager(); |
|
|
|
|
//server.WithWebApi("/api", m => m.WithController(() => new TestController())); |
|
|
|
|
server.WithStaticFolder("/", Path.Combine("d:", "docs_tgb/TGB_REPAIR"), true, module => |
|
|
|
|
{ |
|
|
|
|
module.OnMappingFailed = OnMappingFailed; |
|
|
|
|
}); |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
await server.RunAsync(); |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
Debug.WriteLine(ex); |
|
|
|
|
} |
|
|
|
|
} |