Can you host a ServiceStack Web App in IIS? - iis

I have made a ServiceStack Web App that uses a custom AppHost from a plugin (similar to the example https://github.com/NetCoreWebApps/WebApp/tree/master/src/apps/chat). I can run it on macOS with the dotnet command as per the examples.
Can I host my Service Stack Web App on IIS? What approach should I take? Reverse-proxying Kestrel like this https://learn.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x
or will I need to have different AppHost/Startup code for the two hosting situations?
Or maybe there's a fundamental reason why it will never work?

WebApp is a standard .NET Core 2.0 App so you'll be able to host it as you would any other .NET Core App. Normally reverse proxies don't require anything except the internal url where the request is proxied to, but it looks like IIS wants you to explicitly call .UseIISIntegration() which is an issue that may have prevented the existing WebApp binary as it didn't call .NET Core 2.0 WebHost.CreateDefaultBuilder(args) which among other things would turn on IISIntegration when the .NET Core App is hosted in IIS/Windows which is now being done from this commit.
You can find the updated Web App binaries with this change in the /web folder of the https://github.com/NetCoreWebApps/Chat project.

Related

Triggering startup of an ASP.Net Core app under IIS

I am running an ASP.Net Core 3.1 web application under IIS. It works as expected except for one thing. The application does not startup until an endpoint has been hit.
This is not a problem on the initial startup as I can just trigger an endpoint as part of the installation scripts. The problem is when there is a service interruption which causes the application to stop. My app pre-loads data on startup in order to improve performance (using IHostedService implementations) and this now does not happen until someone is actually trying to use the service.
I was wondering if there is either an IIS or ASP.Net setting I could use so that the application will automatically start up as soon as the IIS web site is running. The best I can think of at the moment is having a separate application poll a liveness endpoint.
If you are running IIS 7.5 or higher, this is doable by configuring both the app pool start mode and setting the app/site to preload. See this existing answer: https://stackoverflow.com/a/47199169/203172

How inprocess asp.net hosting model working in Linux container

Hi I am new to container. Thus asking this, may be a foul question.
The default hosting model of asp.net core is InProcess that requires IIS.
Now if we create an Linux image on a default asp.net core web app it is running and serving request.
I am confused here, how a Linux based image of .net core could serve InProcess hosting model
After lot of research, it is evident to me that running application through dotnet CLI ignores the hosting model settings. The same could be seen as when running the application with dotnet run command from local machine. It then always returned response that could be seen be returned from kestrel no matter what is the hosting model settings.
Hope it will help other to understand the trick that could not see any where documented.

How can I set my ASP.NET Core web app to be "always running" in local development?

I am in the process of converting a set of web applications from ASP.NET MVC 5 to ASP.NET Core.
Under the old ASP.NET, our applications were typically set up to run under "Local IIS" at a specific port and route. The benefit of this was that you could have multiple applications checked out and running locally without having to explicitly start or debug them all. After making a code change and rebuilding, IIS would spin up a new app domain and you could immediately start hitting the up-to-date code.
In contrast, all the ASP.NET Core apps I've seen so far use IIS Express instead of local IIS (as specified in launchSettings.json). How can I configure local IIS (or at least equivalent behavior)?

launchsettings.json - commandName, IIS or Project for Production?

For an MVC core live production website, I am trying to understand which commandName setting I should be using in my launchsettings.json. My understanding is that if I set Project it will use the Kestrel server to host the website. If I set IIS it will then use IIS.
From my research into Kestrel, it is said that Kestrel should be used behind one of the main host servers such as IIS due to its lack of features as it was scaled for performance. This begs me to wonder how I would accomplish such a thing. In my current setup, I am using shared hosting to host a website and I would like to know if I should be putting the commandName setting to IIS or Project, will it even make a difference in my case?

Deploy angular 4 App in IIS

I have a multi-tenant Angular 4 and .Net core 2.0 application.
I have hosted .Net core API in IIS with deployment time debugging and for that I have followed this link.
https://learn.microsoft.com/en-us/aspnet/core/publishing/development-time-iis-support
With this configuration in IIS, I can access my API any time and if I want to debugg it, I can run it in VS.
Now, Is it possible to run Angular app directly with IIS. I mean is there any way that npm start will directly open app in specific IIS url like app.myapp.local, and not at localhost:4200
what I have did so far?
I have added one folder in wwwroot/myapp, and I have pointed it to Default web site in IIS.
then, I am building my app with ng build, copying all content of dist folder to wwwroot/myapp.
Is there any proper way in Angular, to handle this kind of scenario?
this question is not same as this Deploy angular application on IIS
because as I specified, I want to start my app in debugging mode at specific URL without building it, So please don't add it in duplicate without understanding question.

Resources