gpt4 book ai didi

visual-studio - asp.net core "The Application Url cannot contain a query string or fragment"错误

转载 作者:行者123 更新时间:2023-12-05 01:36:15 25 4
gpt4 key购买 nike

在我的 ASP.NET Core 3.1 应用程序中,我需要在应用程序启动时立即设置查询字符串参数。但是,当我在 launchsettings.json 文件中设置具有查询字符串参数的 applicationUrl 时,应用程序无法启动。

您可以看到,应用程序 URL 框变成黄色并且 Visual Studio 不允许我保存!

enter image description here

如果我在文本编辑器中打开 launchsettings.json,设置此 URL 并保存文件,从 Visual Studio 运行应用程序时会出现以下错误。我收到以下错误:

enter image description here

谁能解释一下, 1.为什么不可能? 2. 解决办法是什么? 3. ASP.NET Core 在 session 开始时传递一些值的方式是什么?

注意:我需要在启动应用程序时传递 TPAId,因为我的应用程序是许多其他企业应用程序之一,这在某种程度上迫使我这样做。

最佳答案

在您的 launchSettings.json 文件中,您可以在 Profiles 下添加一个 launchUrl 属性。

"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "?TPAId=876894",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
}
}

关于visual-studio - asp.net core "The Application Url cannot contain a query string or fragment"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62208094/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com