Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application is running inside IIS process but is not configured to use IIS server. #2

Open
ionutafloarei opened this issue Mar 3, 2019 · 5 comments

Comments

@ionutafloarei
Copy link

In this project, if it is launched on local host "debug" mode everything works ok. However, after I deploy the project on Azure Function App there is an error when the function call for any web api like this one below:

https://[...].azurewebsites.net/api/Values

The azure function app was created with the default settings and with ASPNETCORE_DETAILEDERRORS = true in order to be able to see the server error.

The stack trace error can be found below:

An error occurred while starting the application.

InvalidOperationException: Application is running inside IIS process but is not configured to use IIS server.
Microsoft.AspNetCore.Server.IIS.Core.IISServerSetupFilter+<>c__DisplayClass2_0.b__0(IApplicationBuilder app)

InvalidOperationException: Application is running inside IIS process but is not configured to use IIS server.
Microsoft.AspNetCore.Server.IIS.Core.IISServerSetupFilter+<>c__DisplayClass2_0.b__0(IApplicationBuilder app)
Microsoft.AspNetCore.HostFilteringStartupFilter+<>c__DisplayClass0_0.b__0(IApplicationBuilder app)
Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter+<>c__DisplayClass0_0.b__0(IApplicationBuilder builder)
Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

Show raw exception details
System.InvalidOperationException: Application is running inside IIS process but is not configured to use IIS server.
at Microsoft.AspNetCore.Server.IIS.Core.IISServerSetupFilter.<>c__DisplayClass2_0.b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
.NET Core 4.6.27317.07 X64 v4.0.0.0 | Microsoft.AspNetCore.Hosting version 2.2.0-rtm-35687 | Microsoft Windows 10.0.14393 | Need help?

@ionutafloarei
Copy link
Author

this issue was reported on Azure functions
Azure/Azure-Functions#1114

@peterson1
Copy link

I'm having the exact same issue.
@ionutafloarei , were you able to resolve this?

@Cubelaster
Copy link

Also having the same issue, but with publish on Azure Web App Service.
I managed to pinpoint the problem somewhere to in-process and out-of-process stuff, but couldn't figure it out.
I had the clean 3.1 core app and went to publish.

@NeelBhatt
Copy link

Also having the same issue, but with publish on Azure Web App Service. I managed to pinpoint the problem somewhere to in-process and out-of-process stuff, but couldn't figure it out. I had the clean 3.1 core app and went to publish.

Do you know solution for this?

@Cubelaster
Copy link

Been a long time but there are a couple of things you could check:

  1. web.config should have correct configuration => example is InProcess + .dll (don't think this is the issue right now)
  2. Your Program.cs should use configuration supporting IIS, NOT KESTREL.

If I remember correctly, Azure killed of my Kestrel config because it only runs IIS and default configuration for any .NET Core project is Kestrel.

Something along those lines:
Also, if I remember correctly, ASPNETCORE_ENVIRONMENT is actually null on Azure because it's a part of Kestrel config, so you'd have to setup the IIS webconfig correctly.

 .ConfigureWebHostDefaults(webBuilder =>
                {
                    var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");

                    if (environment == "Development")
                    {
                        webBuilder
                            .UseKestrel()
                            .ConfigureKestrel(serverOptions =>
                            {
                                serverOptions.Limits.MaxRequestBodySize = 10 * 1024;

                                serverOptions.ConfigureHttpsDefaults(listenOptions =>
                                {
                                    listenOptions.SslProtocols = SslProtocols.Tls12;
                                });
                            })
                            .UseStartup<Startup>();
                    }
                    else
                    {
                        webBuilder
                            .CaptureStartupErrors(true)
                            .UseSetting("detailedErrors", "true")
                            .UseStartup<Startup>();
                    }
                });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants