Tag: 谷歌日历

无法从Docker容器打开URL

从Docker容器导航到Google身份validation页面时遇到问题。 该应用程序使用asp.net Core 2.0制作,目的是显示即将从Google Calendar API检索的事件,并根据需要创build事件。 当应用程序没有从Docker容器运行时,应用程序将按预期工作,生成授权代码请求URL,并基于环境(Windows,Linux或OSX)尝试使用OpenBrowser方法中的Process.start()打开URL。 private bool OpenBrowser(string url) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { url = System.Text.RegularExpressions.Regex.Replace(url, @"(\\*)" + "\"", @"$1$1\" + "\""); url = System.Text.RegularExpressions.Regex.Replace(url, @"(\\+)$", @"$1$1"); Process.Start(new ProcessStartInfo("cmd", $"/c start \"\" \"{url}\"") { CreateNoWindow = true }); return true; } if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { Process.Start("xdg-open", url); return true; } if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { Process.Start("open", […]