What is the Difference Between UseIIS and UseIISIntegration?
WebHost.CreateDefaultBuilder calls both UseIIS and UseIISIntegration. Looking at the code for both, they have the exact same comment, suggesting that they do the same thing:
/// <summary>
/// Configures the port and base path the server should listen on when
/// running behind AspNetCoreModule. The app will also be configured
/// to capture startup errors.
/// </summary>
UseIIS lives in the Microsoft.AspNetCore.Server.IIS package, while UseIISIntegration lives in Microsoft.AspNetCore.Server.IISIntegration. What is the difference between the two? When do you need to use one versus the other? Why does WebHost.CreateDefaultBuilder call both?
Out-of-proc is the default behaviour, this may change in the future.
So one is for in-proc and one for out-of-proc? I'm assuming UseIIS is in-proc, since it's new.
If I'm using <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>, then in theory I only need UseIIS right?
Yes, it essentially checks whether the aspnetcorev2_inprocess.dll is loaded and then sets up the pipeline.
What about IIS Express when developing? Doing some testing, it seems like it respects the AspNetCoreHostingModel setting. So if I only want to use in-process hosting, it seems safe to only use UseIIS and both full IIS and IIS Express will still work.
Also, if I only want to use IIS Express for development, how can I conditionally add UseIIS? I don't have access to the IHostingEnvironment interface.
UseIIS is not optional in the case of using IIS Express for development.
Actually, if you are talking out of process vs in process then yes you are right. Sorry I misunderstood but it is expected that this switch is driven from web.config so my question is why would you want to bypass this functionality.
Isn't the switch based on the <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel> setting in the csproj? I guess that probably just injects something into the web.config which is the real decision maker for which type of hosting to use.
Yeah the work is done inside the ANCM.
Thanks, I think I get it now.