Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No suitable 'Program' type for an entry point

Tags:

asp.net-core

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.

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?

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

sdk: v1.0.0-rc2-16357

like image 887
roydukkey Avatar asked Oct 31 '22 12:10

roydukkey


1 Answers

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

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

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"
    }

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"
}

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

like image 87
roydukkey Avatar answered Jan 04 '23 13:01

roydukkey