我有一个 ASP.Net 框架 (v4.7) Web 应用程序,我在 Azure Devops Server (2019) 中有一个构建管道。
\n\n有一个 Visual Studio 构建任务可以很好地构建解决方案并将站点发布到文件_PublishedWebsites夹。问题是,该版本的 web.config 转换尚未应用,但它仍然已debug="true"设置,这不是我想要的自动化部署。
该任务的 msbuild 参数为:/p:outdir="$(build.artifactstagingdirectory)"且构建的 BuildConfiguration 变量设置为release。
当我使用 Visual Studio 发布项目时,将应用 web.release.config 转换,并且调试属性已从已发布内容的 web.config 文件中删除。
\n\n我在这里缺少什么吗?
\n\n编辑:构建管道 YAML:
\n\nqueue:\n name: Default\n demands: \n - msbuild\n - visualstudio\n\n#Your build pipeline references an undefined variable named \xe2\x80\x98Parameters.solution\xe2\x80\x99. Create or edit the build pipeline for this YAML file, define the variable on the Variables …Run Code Online (Sandbox Code Playgroud) 这是我从 ASP.Net Core 2.2 更新到 3.1 的第二个项目。第一个运行良好。第二个在 Visual Studio (2019) 中运行良好,但是当您发布它并从 dotnet CLI 运行它时,控制台会无限期挂起,控制台中没有输出,我启用了 stdout,输出文件为零字节。
该解决方案托管在 IIS 中,当我尝试通过 IIS 运行它时,我在应用程序事件日志中看到以下条目:
具有物理根目录 'D:\wwwroot\InclusionService_UAT\' 的应用程序 '/LM/W3SVC/2/ROOT' 无法使用命令行 'C:\Program Files\dotnet\dotnet.exe .\InclusionService.Web.dll' 启动进程阶段 'PostStartCheck',ErrorCode = '0x8027025a',分配端口 12973,retryCounter '1'。
和
具有物理根目录 'D:\wwwroot\InclusionService_UAT\' 的应用程序 '/LM/W3SVC/2/ROOT' 无法使用命令行 'C:\Program Files\dotnet\dotnet.exe .\InclusionService.Web.dll' 启动进程多次重试。无法绑定到端口“35033”。从多次重试中捕获的 stdout 和 stderr 日志的前 30KB 字符:不再显示
这是我的 Program.cs,在我的其他迁移解决方案中完全相同:
public static void Main(string[] args)
{
var builder = new HostBuilder()
.ConfigureWebHostDefaults(opt =>
{
opt.UseStartup<Startup>();
opt.UseIISIntegration();
});
var host = builder.Build();
host.Start();
}
Run Code Online (Sandbox Code Playgroud)
如果有一些输出,调试会容易得多,但没有什么可继续的。