Reputation: 35
I have a .NET core 2.0 web application running successfully as an Azure app service.
To save money/complication, I would like to run its public API on the same domain, as a virtual application i.e. www.mysite.com/api
However, when I release to the virtual application, and then try to access it, I simply get an error message saying:
"The page cannot be displayed because an internal server error has occurred."
I am an experienced .NET framework developer, but this is my first .NET core project, so I am a little unsure how to debug this.
Just to confirm, I have a .NET core website and a .NET core web API, where the web API is meant to live in the "/api" virtual application. I have setup the virtual application within the Azure app service as "site\api" (with the main website being "site\wwwroot")
The API has its own web.config etc. as expected. I am guessing this is all caused by some config I haven't done, but I am unsure as to what exactly.
Upvotes: 0
Views: 4326
Reputation: 15770
The problem is that you "Sub-Application" has an web.config
file generated that has a duplicate entry in it the parent web.config
already has:
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
See this article here: https://github.com/aspnet/IISIntegration/issues/190
Upvotes: 2
Reputation: 9845
In addition to what @Neil said, enable startup errors because the application might already fail to boot which will cause no developer exception page to be shown at all.
In your program.cs adjust the webhost build process
return WebHost.CreateDefaultBuilder(args)
.CaptureStartupErrors(true) // add this line
.UseSetting(WebHostDefaults.DetailedErrorsKey, "true") // and this line
.UseKestrel()
.UseStartup<Startup>()
.Build();
Upvotes: 0
Reputation: 11919
In your Startup.cs, you will probably have something like:
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
Just comment out the if
, and you will get the developer exception page in 'production'.
That might give you a clue as to what the real problem is.
Upvotes: 0