【问题标题】:Error message when debugging .NET Core RC2 web application in Service Fabric在 Service Fabric 中调试 .NET Core RC2 Web 应用程序时出现错误消息
【发布时间】:2016-09-21 16:02:27
【问题描述】:

我终于设法将 .NET Core RC2 Web 应用程序上传到 Service Fabric。但是一旦部署它,我就会在 Visual Studio 中收到以下错误消息:

在 Service Fabric Explorer 中,Web 应用程序的分区中出现以下错误:

我的 ServiceManifest.xml 如下所示:

<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="WebApplicationPkg"
             Version="1.0.0"
             xmlns="http://schemas.microsoft.com/2011/01/fabric"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ServiceTypes>
    <StatelessServiceType ServiceTypeName="WebApplicationType" />
  </ServiceTypes>

  <CodePackage Name="Code" Version="1.0.0">
    <EntryPoint>
      <ExeHost>
        <Program>WebApplication.exe</Program>
      </ExeHost>
    </EntryPoint>
  </CodePackage>
  <ConfigPackage Name="Config" Version="1.0.0" />

  <Resources>
    <Endpoints>
      <Endpoint Name="ServiceEndpoint" />
    </Endpoints>
  </Resources>
</ServiceManifest>

还有我的 project.json:

{
  "dependencies": {
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview1-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final",
    "NETStandard.Library": "1.5.0-rc2-24027"
  },

  "tools": {
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    },
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    }
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "dnxcore50",
        "portable-net45+win8"
      ]
    }
  },

  "runtimes": {
    "win10-x64": { }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "gcServer": true
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
  }
}

我的 Progam.cs:

public class Program
{
    public static void Main(string[] args)
    {
        var host = new WebHostBuilder()
            .UseKestrel()
            .UseStartup<Startup>()
            .Build();

        host.Run();
    }
}

谁能看到我做错了什么?这个错误来自哪里? 当我在本地运行应用程序时,它很好。只要我将它部署到 Service Fabric,我就会收到这些错误。

谢谢!

【问题讨论】:

    标签: c# asp.net-core azure-service-fabric


    【解决方案1】:

    我之前遇到过类似的问题。我还没有找出具体的问题。我怀疑这是因为服务没有将自己注册到服务结构运行时,导致健康分区的数量(针对特定服务)低于指定值(应用程序清单中的 InstanceCount)。

    我通过基于 SDK 中提供的 OwinCommunicationListener 创建一个通信监听器解决了这个问题。我的实现与您在Hosting repo by weidazhao (David) 中找到的非常相似。我建议这样做,因为它似乎与官方 SDK 中的内容足够接近。

    【讨论】:

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