From 4a5bc2457959b8e445f6a651cc0f5153d49b2baf Mon Sep 17 00:00:00 2001 From: ZhaoLei Date: Thu, 17 Oct 2024 15:24:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=20=E4=B8=8D=E5=9C=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=B8=AD=E7=BB=91=E5=AE=9Aurl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IIS托管时,代码中指定 Urls 将导致无法启动错误 ```csharp //app.Urls.Clear(); //app.Urls.Add("http://0.0.0.0:6819"); ``` 无代理时使用 .\LocalServer.exe --urls="http://0.0.0.0:6818" 绑定 固定url --- Server/LocalServer/Program.cs | 8 +++++--- Server/RemoteServer/Program.cs | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Server/LocalServer/Program.cs b/Server/LocalServer/Program.cs index e0b2d86..6a7fa93 100644 --- a/Server/LocalServer/Program.cs +++ b/Server/LocalServer/Program.cs @@ -37,14 +37,16 @@ if (app.Environment.IsDevelopment()) app.UseSwaggerUI(); } DefaultFilesOptions defops = new DefaultFilesOptions(); -defops.DefaultFileNames.Clear(); + +//defops.DefaultFileNames.Clear(); defops.DefaultFileNames.Add("index.html"); app.UseDefaultFiles(defops); app.UseStaticFiles(); app.UseWebSockets(); app.UseAuthorization(); -app.Urls.Clear(); -app.Urls.Add("http://0.0.0.0:6818"); + +//app.Urls.Clear(); +//app.Urls.Add("http://0.0.0.0:6818"); app.MapControllers(); app.Run(); diff --git a/Server/RemoteServer/Program.cs b/Server/RemoteServer/Program.cs index 6c11bb7..35d4da4 100644 --- a/Server/RemoteServer/Program.cs +++ b/Server/RemoteServer/Program.cs @@ -40,7 +40,8 @@ if (app.Environment.IsDevelopment()) app.UseSwaggerUI(); } app.UseWebSockets(); -app.Urls.Clear(); -app.Urls.Add("http://0.0.0.0:6819"); + +//app.Urls.Clear(); +//app.Urls.Add("http://0.0.0.0:6819"); app.MapControllers(); app.Run(); From 31ae784aacc42aad1f1f4c7ce66513604d9a0ba1 Mon Sep 17 00:00:00 2001 From: ZhaoLei Date: Thu, 17 Oct 2024 15:26:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20RemoteUrl=20=20=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=8E=A5=E5=8F=A3=20/t=20=E6=9D=A5=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=98=AF=E5=90=A6=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/RemoteServer/Controllers/RemoteServerController.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Server/RemoteServer/Controllers/RemoteServerController.cs b/Server/RemoteServer/Controllers/RemoteServerController.cs index 33f79c5..d59bcd6 100644 --- a/Server/RemoteServer/Controllers/RemoteServerController.cs +++ b/Server/RemoteServer/Controllers/RemoteServerController.cs @@ -12,6 +12,12 @@ public class SyncFilesController(RemoteSyncServerFactory factory, SqliteDbContex private readonly SqliteDbContext _db = db; private readonly RemoteSyncServerFactory Factory = factory; + [HttpGet("/t")] + public IActionResult ConnnectTest() + { + return Ok("网络连接正常!"); + } + [Route("/websoc")] public async Task WebsocketConnection(string Name) { @@ -41,6 +47,7 @@ public class SyncFilesController(RemoteSyncServerFactory factory, SqliteDbContex HttpContext.Response.StatusCode = StatusCodes.Status400BadRequest; } } + /// /// 上传文件 ///