ASpNet 无法在 Azure 上发布
ASpNet fails publish on Azure
我正在使用 AspNet Core 开发后端。
奇怪的是,当我尝试在 Azure 上发布它时出现错误。
当我在 Mac 或 Windows 上本地 运行 我的服务器(使用自己的主机)时,不会发生此错误。
仅限 Azure。
在 Azure 上,它成功完成了还原,但在 publish
期间失败(如果在 publish-iis 之前失败)。
我注意到自从更新到 kestrel 1.0.1 后出现了错误。
使用 kestrel 1.0.0 我没有收到错误。但是那个版本有bug所以我不能再用了
这是输出:
Committing restore...
Writing lock file to disk. Path: D:\home\site\repository\Server\Server\project.lock.json
D:\home\site\repository\Server\Server\project.json
Restore completed in 156613ms.
NuGet Config files used:
C:\DWASFiles\Sites\#1ska-dev-test\AppData\NuGet\NuGet.Config
Feeds used:
https://api.nuget.org/v3/index.json
Installed:
199 package(s) to D:\home\site\repository\Server\AspNet\project.json
20 package(s) to D:\home\site\repository\Server\Server\project.json
Publishing Server for .NETCoreApp,Version=v1.0
Project Core (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
Compiling Core for .NETCoreApp,Version=v1.0
Compilation succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:06.7082402
Project EntityFramework (.NETCoreApp,Version=v1.0) will be compiled because dependencies changed
Compiling EntityFramework for .NETCoreApp,Version=v1.0
Compilation succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:03.8883938
Project AspNet (.NETCoreApp,Version=v1.0) will be compiled because dependencies changed
Compiling AspNet for .NETCoreApp,Version=v1.0
D:\home\site\repository\Server\AspNet\project.json(8,51): error NU1001: The dependency Microsoft.AspnetCore.Diagnostics >= 1.0.0 could not be resolved.
D:\home\site\repository\Server\AspNet\project.json(11,54): error NU1001: The dependency Microsoft.AspnetCore.Server.Kestrel >= 1.0.1 could not be resolved.
D:\home\site\repository\Server\AspNet\project.json(13,51): error NU1001: The dependency Microsoft.AspnetCore.StaticFiles >= 1.0.0 could not be resolved.
D:\home\site\repository\Server\AspNet\project.json(14,64): error NU1001: The dependency Microsoft.AspnetCore.Authentication.JwtBearer >= 1.0.0 could not be resolved.
Compilation failed.
0 Warning(s)
4 Error(s)
Time elapsed 00:00:00.0086802
Published 0/1 projects successfully
Failed exitCode=1, command=dotnet publish "D:\home\site\repository\Server\Server" --output "D:\local\Tempd3eb5bf7d29666" --configuration Release
An error has occurred during web site deployment.
D:\home\site\repository\Server\AspNet\project.json(8,51): error NU1001: The dependency Microsoft.AspnetCore.Diagnostics >= 1.0.0 could not be resolved.\r\nD:\home\site\repository\Server\AspNet\project.json(11,54): error NU1001: The dependency Microsoft.AspnetCore.Server.Kestrel >= 1.0.1 could not be resolved.\r\nD:\home\site\repository\Server\AspNet\project.json(13,51): error NU1001: The dependency Microsoft.AspnetCore.StaticFiles >= 1.0.0 could not be resolved.\r\nD:\home\site\repository\Server\AspNet\project.json(14,64): error NU1001: The dependency Microsoft.AspnetCore.Authentication.JwtBearer >= 1.0.0 could not be resolved.\r\nD:\Program Files (x86)\SiteExtensions\Kudu.50929.2438\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
这是我得到的输出:
{
"authors": [
"cucu"
],
"version": "1.0.0-*",
"dependencies": {
"EntityFramework": "1.0.0",
"Microsoft.AspnetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspnetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.1",
"Microsoft.AspnetCore.StaticFiles": "1.0.0",
"Microsoft.AspnetCore.Authentication.JwtBearer": "1.0.0",
"Microsoft.Extensions.Configuration.Json": " 1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Caching.Abstractions": "1.0.0",
"Microsoft.Extensions.Caching.Memory": "1.0.0",
"System.IdentityModel.Tokens.Jwt": "5.0.0",
"AutoMapper": "5.1.1"
},
"frameworks": {
"netcoreapp1.0": { }
},
"publishOptions": {
"include": [
"Properties"
]
},
"buildOptions": {
"preserveCompilationContext": true
}
}
这是我的 project.json:
我找到了一个 'dirt' 有效的解决方案:
- 我在 Azure 上复制目标版本的二进制文件
- 我在 .deployment
中创建了部署命令 (deploy.cmd)
- deploy.cmd 应该是这样的:http://pastebin.com/FWqEY0SK(注意第 76 行)
我正在使用 AspNet Core 开发后端。 奇怪的是,当我尝试在 Azure 上发布它时出现错误。 当我在 Mac 或 Windows 上本地 运行 我的服务器(使用自己的主机)时,不会发生此错误。 仅限 Azure。
在 Azure 上,它成功完成了还原,但在 publish
期间失败(如果在 publish-iis 之前失败)。
我注意到自从更新到 kestrel 1.0.1 后出现了错误。 使用 kestrel 1.0.0 我没有收到错误。但是那个版本有bug所以我不能再用了
这是输出:
Committing restore...
Writing lock file to disk. Path: D:\home\site\repository\Server\Server\project.lock.json
D:\home\site\repository\Server\Server\project.json
Restore completed in 156613ms.
NuGet Config files used:
C:\DWASFiles\Sites\#1ska-dev-test\AppData\NuGet\NuGet.Config
Feeds used:
https://api.nuget.org/v3/index.json
Installed:
199 package(s) to D:\home\site\repository\Server\AspNet\project.json
20 package(s) to D:\home\site\repository\Server\Server\project.json
Publishing Server for .NETCoreApp,Version=v1.0
Project Core (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
Compiling Core for .NETCoreApp,Version=v1.0
Compilation succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:06.7082402
Project EntityFramework (.NETCoreApp,Version=v1.0) will be compiled because dependencies changed
Compiling EntityFramework for .NETCoreApp,Version=v1.0
Compilation succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:03.8883938
Project AspNet (.NETCoreApp,Version=v1.0) will be compiled because dependencies changed
Compiling AspNet for .NETCoreApp,Version=v1.0
D:\home\site\repository\Server\AspNet\project.json(8,51): error NU1001: The dependency Microsoft.AspnetCore.Diagnostics >= 1.0.0 could not be resolved.
D:\home\site\repository\Server\AspNet\project.json(11,54): error NU1001: The dependency Microsoft.AspnetCore.Server.Kestrel >= 1.0.1 could not be resolved.
D:\home\site\repository\Server\AspNet\project.json(13,51): error NU1001: The dependency Microsoft.AspnetCore.StaticFiles >= 1.0.0 could not be resolved.
D:\home\site\repository\Server\AspNet\project.json(14,64): error NU1001: The dependency Microsoft.AspnetCore.Authentication.JwtBearer >= 1.0.0 could not be resolved.
Compilation failed.
0 Warning(s)
4 Error(s)
Time elapsed 00:00:00.0086802
Published 0/1 projects successfully
Failed exitCode=1, command=dotnet publish "D:\home\site\repository\Server\Server" --output "D:\local\Tempd3eb5bf7d29666" --configuration Release
An error has occurred during web site deployment.
D:\home\site\repository\Server\AspNet\project.json(8,51): error NU1001: The dependency Microsoft.AspnetCore.Diagnostics >= 1.0.0 could not be resolved.\r\nD:\home\site\repository\Server\AspNet\project.json(11,54): error NU1001: The dependency Microsoft.AspnetCore.Server.Kestrel >= 1.0.1 could not be resolved.\r\nD:\home\site\repository\Server\AspNet\project.json(13,51): error NU1001: The dependency Microsoft.AspnetCore.StaticFiles >= 1.0.0 could not be resolved.\r\nD:\home\site\repository\Server\AspNet\project.json(14,64): error NU1001: The dependency Microsoft.AspnetCore.Authentication.JwtBearer >= 1.0.0 could not be resolved.\r\nD:\Program Files (x86)\SiteExtensions\Kudu.50929.2438\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
这是我得到的输出:
{
"authors": [
"cucu"
],
"version": "1.0.0-*",
"dependencies": {
"EntityFramework": "1.0.0",
"Microsoft.AspnetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspnetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.1",
"Microsoft.AspnetCore.StaticFiles": "1.0.0",
"Microsoft.AspnetCore.Authentication.JwtBearer": "1.0.0",
"Microsoft.Extensions.Configuration.Json": " 1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Caching.Abstractions": "1.0.0",
"Microsoft.Extensions.Caching.Memory": "1.0.0",
"System.IdentityModel.Tokens.Jwt": "5.0.0",
"AutoMapper": "5.1.1"
},
"frameworks": {
"netcoreapp1.0": { }
},
"publishOptions": {
"include": [
"Properties"
]
},
"buildOptions": {
"preserveCompilationContext": true
}
}
这是我的 project.json:
我找到了一个 'dirt' 有效的解决方案:
- 我在 Azure 上复制目标版本的二进制文件
- 我在 .deployment 中创建了部署命令 (deploy.cmd)
- deploy.cmd 应该是这样的:http://pastebin.com/FWqEY0SK(注意第 76 行)