master
ygl 3 years ago
parent 675e512f72
commit 21082bebf8
  1. 28
      realm_cli/Program.cs
  2. 1
      realm_cli/realm_cli.csproj

@ -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);
}
}

@ -9,6 +9,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EmbedIO" Version="3.5.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.17" />
<PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.2" />
<PackageReference Include="Realm" Version="10.18.0" />

Loading…
Cancel
Save