Unable to start Kestrel: path base can only be configured using IApplicationBuilder.UsePathBase
See original GitHub issueFrom @JDGHHou on September 4, 2018 19:3
My application runs fine in Visual Studio 2017 using the built-in IIS Express. However, when I deploy my code to IIS, suddenly I get the attached error.
I have found a couple of articles saying that I need to set my application URL to “applicationUrl”: “http://localhost/” rather than “applicationUrl”: “http://localhost/{my application name}/”
But when I do that, my application tries to deploy to the webroot, and my application is stored in a folder elsewhere, so that doesn’t work.
In all this, I am so confused as to what Microsoft’s approach is. Why - if IIS Express works great at the press of a button - doesn’t Microsoft just copy that exactly and apply it to IIS? I understand there may be more in-depth configuration a user may need to do, but that should be optional for users who need something more complex. Deploying something in IIS is almost always a complete living nightmare involving a million random undocumented settings. It is needlessly difficult and seems to default to the most random edge-case setup, rather than the most simple.
Anyway… Can someone please tell me how to make my application just deploy to IIS and work the same as it already does on other Microsoft products?
----------THIS IS THE ERROR MESSAGE -------------------- System.InvalidOperationException: ‘A path base can only be configured using IApplicationBuilder.UsePathBase().’
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using ‘C:\Users\JohnDunn\AppData\Local\ASP.NET\DataProtection-Keys’ as key repository and Windows DPAPI to encrypt keys at rest.
crit: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to start Kestrel.
System.InvalidOperationException: A path base can only be configured using IApplicationBuilder.UsePathBase().
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.ParseAddress(String address, Boolean& https)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IServerAddressesFeature addresses, KestrelServerOptions serverOptions, ILogger logger, Func2 createBinding) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication
1 application, CancellationToken cancellationToken)
Copied from original issue: aspnet/KestrelHttpServer#2882
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (8 by maintainers)
@shirhatti Where do we have guidance on IIS deployments? https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.1&tabs=aspnetcore2x?
@JDGHHou This isn’t a Kestrel specific issue but the error is caused by trying to set a path base via the
applicationUrl
configuration, which is not supported. Instead, you should be using theUsePathBase
method as suggested in the error message, for example, keep theapplicationUrl
set to “http://localhost/” and use the followingConfigure
methodI basically just need to take an application that works fine when I launch it in IIS Express and publish it to standalone IIS and have it run the same way. It shouldn’t be difficult. Microsoft has done an excellent job of providing a quick and painless web host in IIS Express, and I don’t understand why the same code doesn’t just work the same way in IIS.
On Mon, Sep 10, 2018, 1:24 PM Eilon Lipton notifications@github.com wrote: