加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-core – 入口点没有合适的“程序”类型

发布时间:2020-12-16 03:24:15 所属栏目:asp.Net 来源:网络整理
导读:看起来每晚RC2版本的最新更新改变了程序启动的方式.自更新以来,我现在在运行以下命令时出现错误. // "commands": {// "web": "Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:1287"// }dnx --watch web'Microsoft.AspNet.Server.Kestrel'
看起来每晚RC2版本的最新更新改变了程序启动的方式.自更新以来,我现在在运行以下命令时出现错误.

// "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编译并具有以下方法.

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

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

需要做些什么才能让程序启动最新的nightly版本?

这是一个重现问题的例子. https://github.com/roydukkey/moist/tree/stackoverflow-34615917

sdk:v1.0.0-rc2-16357

解决方法

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

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. 07001

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

"compilationOptions": {
        "emitEntryPoint": true
    },"commands": {
-       "web": "Microsoft.AspNet.Server.Kestrel"
+       "web": "Web"
    }

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

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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读