I have a problem in running an asp.net core website on remote server. I want to use kestrel with IIS ,and published it in visual studio 2017 It's my program.cs:
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseUrls("http://example.com")
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
.Build();
host.Run();
}
At the remote server when I double click on myWebAppName.exe the kestrel run and very fast closed What i must do? pleas, help me
First of all: you don't need to click on app .exe file if you want to host in IIS. Doing this you run it as a standalone application. Instead you should create a IIS Website.
Configuration via code is only one of steps. You need also configure IIS to host your app. Follow this Set up a hosting environment for ASP.NET Core on Windows with IIS, and deploy to it official documentation to setup everything right.
Note: some steps are different for varied ASP.NET Core versions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With