Skip to content

Can't Use WebListener With IIS #1306

Closed
Closed
@mylifeandcode

Description

@mylifeandcode

I'm trying to host an ASP.NET Core application under IIS using the WebListener service, and am trying to get it to make use of Windows Authentication. However, when WebListener is specified for my "web" command, and the application is deployed and set up under IIS, I get a 502 response with the message "Web server received an invalid response while acting as a gateway or proxy server."

I'm able to successfully host the application using Kestrel under IIS, but unfortunately Kestrel doesn't support NTLM (or at least that's what I've read and experienced).

So, I'm looking for a way to:

Get the application to work using WebListener instead of Kestrel, and
Get it to work with Windows Authentication
This all works locally when using the web command locally (i.e. running it in Visual Studio). It just doesn't work from WebListener under IIS.

I have the latest HttpPlatformHandler installed (1.2). I have the forwardWindowsAuthToken setting set to true. I have AnonymousAuthentication disabled and WindowsAuthentication enabled in config. I am targeting 1.0.0-rc1-update1.

Here is some of the configuration code in my Startup.cs file:


public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    app.UseIISPlatformHandler();

    SetupWindowsAuthForLocalDev(app);

    app.UseMvc();
    app.UseDefaultFiles();
    app.UseStaticFiles();
    app.UseDeveloperExceptionPage();

    app.UseRuntimeInfoPage();

    app.UseAutoMapper();
    app.ConfigureStorageAccountForCors(_config);

    loggerFactory.AddSerilog();
}


private static void SetupWindowsAuthForLocalDev(IApplicationBuilder app)
{

    var listener = app.ServerFeatures.Get<WebListener>();
    if (listener != null)
    {
        listener.AuthenticationManager.AuthenticationSchemes =
            AuthenticationSchemes.NTLM;
    }
}


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions