入口点没有合适的“程序"类型 [英] No suitable 'Program' type for an entry point

查看:90
本文介绍了入口点没有合适的“程序"类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎每晚RC2版本的最新更新都改变了程序的启动方式.自更新以来,运行以下命令时出现错误.

It seems that a recent update in the nightly RC2 builds has changed the way that programs are started up. Since updating, I'm now presented with an error when running the following command.

// "commands": {
//      "web": "Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:1287"
// }

dnx --watch web

'Microsoft.AspNet.Server.Kestrel' does not contain a 'Program' type suitable for an entry point Stopped listening.

Startup.cs会编译并具有以下方法.

The Startup.cs compiles and has the follow methods.

public class Startup
{
    public void ConfigureServices(IServiceCollection services, IHostingEnvironment env)
    { ... }

    public void Configure(IApplicationBuilder app, IApplicationLifetime lifetime)
    { ... }
}

要使程序以最新的每晚版本启动,需要做些什么?

What needs to be done to get the program to start up with the latest nightly builds?

这里是重现此问题的示例. https://github.com/roydukkey/moist/tree/stackoverflow-34615917

Here is an example that reproduces the issue. https://github.com/roydukkey/moist/tree/stackoverflow-34615917

sdk:v1.0.0-rc2-16357

推荐答案

aspnet/Hosting#521 ,多个入口点已被删除.

In aspnet/Hosting#521, multiple entry points have been removed.

以前,我们有多个Web应用程序入口点,包括托管(Microsoft.AspNet.Hosting),服务器(例如Microsoft.AspNet.Server.Kestrel)和应用程序本身(例如Startup.cs).我们已经删除了主机和服务器中的入口点,因此前进的唯一入口点是来自应用程序.这将需要更新project.json,包括在compilationOptions下将emitEntryPoint设置为true,以及将commands设置为指向启动程序集. aspnet/Announcements#131

Previously we had multiple entry points for web applications including in Hosting (Microsoft.AspNet.Hosting), Servers (e.g. Microsoft.AspNet.Server.Kestrel) and the the application itself (e.g. Startup.cs). We have removed the entry points in Hosting and the servers so the only entry point moving forward is from the application. This will required updates to the project.json including setting emitEntryPoint to true under compilationOptions and setting commands to point to the Startup assembly. aspnet/Announcements#131

要解决此问题,commands设置需要指向一个程序集,而不是列出以前有效的服务器配置.此外,需要启用emitEntryPoint设置.这两个设置都是从​​project.json设置的.

To solve the issue the commands settings needs to point to an assembly instead of listing the, previously valid, server configuration. Additionally, the emitEntryPoint setting needs to be enabled. Both these settings are set from the project.json.

    "compilationOptions": {
        "emitEntryPoint": true
    },

    "commands": {
-       "web": "Microsoft.AspNet.Server.Kestrel"
+       "web": "Web"
    }

特定的服务器配置现在位于hosting.json中.以下仅是示例配置.

Specific server configurations are now located in the hosting.json. The following is just an example configuration.

{
    "server": "Microsoft.AspNet.Server.Kestrel",
    "server.urls": "http://localhost:1234"
}

请依次参阅 roydukkey/moist/tree/stackoverflow-34615917 查看整个问题的工作流程.

Please refer to roydukkey/moist/tree/stackoverflow-34615917 in order to view workflow throughout this question.

这篇关于入口点没有合适的“程序"类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆