如何从本地系统中的文件夹启动MVC服务器

时间:2018-05-14 06:44:33

标签: c# asp.net-mvc asp.net-core

在我的本地系统中,我发布了一个Asp.net核心Web应用程序。如何从该文件夹启动服务器,该服务器将监听用户请求。我试过Httplistener和Weblistener。但路由在两种情况下都不起作用。

我的http.sys代码: `

var builder = new WebHostBuilder().UseKestrel()

        .UseStartup<Startup>()

        .UseHttpSys(options =>
        {
            // The following options are set to default values.
            options.Authentication.Schemes = Microsoft.AspNetCore.Server.HttpSys.AuthenticationSchemes.None;
            options.Authentication.AllowAnonymous = true;
            options.MaxConnections = null;

            options.UrlPrefixes.Add("http://localhost:9000");
        }).UseContentRoot(@"path to my publish folder")

        .Build();

            builder.Run();`

我正在尝试使用http.sys。在这种情况下,我能够启动服务器,但路由不起作用。

1 个答案:

答案 0 :(得分:0)

如果使用Windows,则可以使用Internet Information Server(IIS)来托管ASP.Net MVC应用程序 请参阅以下链接以获取更多信息:
https://levelnis.co.uk/blog/configure-mvc-website-in-iis