2016-10-03 99 views
0

我正在使用AspNet Core開發後端。 奇怪的是,當我嘗試在Azure上發佈它時,出現錯誤。 當我在Mac或Windows上本地運行我的服務器(使用自主機)時,不會發生此錯誤。 僅在Azure上。ASpNet在Azure上發佈失敗

在Azure上,它成功完成恢復,但在publish期間失敗(如果在publish-iis之前失敗)。

我注意到自從我更新到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

我想出了一個'dirt'solution that works:

  • 我拷貝在Azure上的目標版本的二進制文件
  • 我創建了.deployment
  • deploy.cmd一個deploy命令(deploy.cmd)應該是這樣的:http://pastebin.com/FWqEY0SK(注線76)