我正在使用 AspNet Core 开发后端。 奇怪的是,当我尝试在Azure上发布它时,我得到一个错误。 当我在Mac或Windows上本地运行我的服务器(使用自我主机)时,不会发生此错误。 仅限Azure。
在Azure上,它成功完成了还原,但在publish
期间失败(如果在发布之前失败)。
我注意到自从更新到kestrel 1.0.1后我收到了错误。 使用kestrel 1.0.0我没有得到错误。但是那个版本被窃听了,所以我不能再使用它了。
这是输出:
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\Temp\8d3eb5bf7d29666" --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\58.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:
答案 0 :(得分:0)
我想出了一个“污垢”'有效的解决方案: