我在Visual Studio中创建了一个新的ASP.NET核心Web应用程序(.Net Framework)。我正在使用.NET Framework 4.5.2。我右键单击该项目并选择发布,以使用Web Deploy将项目发布到Azure。第一次尝试失败“缺少根元素”或类似的东西。第二次尝试成功。但每次我尝试将项目发布到Azure中的应用程序站点之后,我都会收到错误:
Web Deploy无法修改目标上的文件“xxx.exe”,因为它已被外部进程锁定。
为什么会这样?
我无法找到解决方案......是否无法以最简单的可能/正常发布方式将ASP.NET核心Web应用程序(.Net Framework)发布到Azure?
我的project.json看起来像这样:
{
"dependencies": {
"AutoMapper": "3.2.1",
"Dropbox.Api": "3.4.0",
"EnterpriseLibrary.TransientFaultHandling": "6.0.1304",
"EntityFramework": "6.1.3",
"Klarna.Net.Api": "4.0.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Routing": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.Azure.DocumentDB": "1.10.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
"PDFsharp": "1.32.3057",
"RavenDB.Client": "2.5.2910",
"SaasKit.Multitenancy": "1.1.4",
"Stripe.net": "6.0.1",
"IdentityServer4.AccessTokenValidation": "1.0.1-rc5",
"Newtonsoft.Json": "9.0.1",
"Microsoft.AspNetCore.Cors": "1.1.0",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Swashbuckle": "6.0.0-beta902"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.1.0-preview4-final",
"imports": "portable-net45+wp80+win8+wpa81+dnxcore50"
}
},
"frameworks": {
"net452": {
"dependencies": {
"Adocka.Common": {
"target": "project"
},
"Adocka.Core": {
"target": "project"
},
"Adocka.Core.Dto": {
"target": "project"
},
"Adocka.Dal": {
"target": "project"
}
}
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true,
"xmlDoc": true
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
答案 0 :(得分:1)
如果您已经发布了自己的应用并且它正在运行,通常就会发生这种情况,因此您会收到错误消息。
进行部署时,首先停止您的Web应用程序(从Azure门户选择您的Web应用程序并按“停止”按钮),执行部署并再次启动它。您也可以使用powershell脚本自动执行该过程。