Got the following issue with a Web API I've been working on, my issue lies within how am I supposed to configure the Web API to work with IIS (Windows Server 2012 R2) considering the fact that I've been following this document's directions and I still get 'This page can't be displayed' browser error :
The Windows Server is hosted on Azure.
I've even added this part related to IIS authentication (thought that this may not cause my issue), adding/removing it has no effect whatsoever.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddOptions();
services.Configure<IISOptions>(options =>
{
options.ForwardWindowsAuthentication = false;
});
}
As in how I've created my publish
folder I've proceeded as following :
dotnet publish
This caused the following folder structure
According to thedirectory structure I do miss wwwroot and Views because I have them implicitly mentioned in my project.json
, but I don't need them since I have a web api and not a web form app.
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
}
Configuring steps on IIS Created a folder on the main drive where I've placed the result of the publish. Went to IIS Manager and added a new website Went to application pool and set the .NET CLR Version to 'No Managed Code'
Launching the app throws me right into this browser error - This page can't be displayed
Running from CMD dotnet mywebapi.dll WORKS... and I've tested it with Postman (have postman on the Windows Server).
You need more information.
Enable and check the application logs at .\\logs\\stdout
.
<system.webServer>
<handlers>
<add
name="aspNetCore"
path="*"
verb="*"
modules="AspNetCoreModule"
resourceType="Unspecified"/>
</handlers>
<aspNetCore
processPath=".\MyApp.exe"
arguments="%LAUNCHER_ARGS%"
stdoutLogEnabled="false" <--- enable
stdoutLogFile=".\logs\stdout" /> <--- set path
</system.webServer>
</configuration>
Check the IIS logs (you probably do NOT have to enable them first). Event Viewer > Windows Logs > Application. To drill down, you can Filter Current Log... by Event level et cetera.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.