【问题标题】:ASpNet fails publish on AzureASpNet 在 Azure 上发布失败
【发布时间】:2016-10-03 07:30:01
【问题描述】:

我正在使用 AspNet Core 开发后端。 奇怪的是,当我尝试在 Azure 上发布它时出现错误。 当我在 Mac 或 Windows 上本地运行我的服务器(使用自主机)时,不会发生此错误。 仅在 Azure 上。

在 Azure 上,它成功完成还原,但在 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:

【问题讨论】:

    标签: asp.net .net asp.net-core .net-core


    【解决方案1】:

    我想出了一个可行的“污垢”解决方案:

    • 我在 Azure 上复制目标版本的二进制文件
    • 我在 .deployment 中创建了一个部署命令 (deploy.cmd)
    • deploy.cmd 应该是这样的:http://pastebin.com/FWqEY0SK(注意第 76 行)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-18
      • 2019-01-02
      • 1970-01-01
      • 1970-01-01
      • 2020-09-01
      • 2016-08-01
      • 2017-04-12
      • 1970-01-01
      相关资源
      最近更新 更多