Reputation: 381
I am having problem configuring .net core application to work as virtual directory in iis. If i start .net core application directly with its port it works fine.
I am getting 502.5 response and in event viewer there is this message
Application 'MACHINE/WEBROOT/APPHOST/DEFAULT WEB SITE' with physical root 'C:\inetpub\wwwroot\' failed to start process with commandline ' ', ErrorCode = '0x80070057 : 0.
I have removed parent handlers in .net web.config like this
<handlers>
<remove name="httpPlatformHandler"/>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
</handlers>
Upvotes: 5
Views: 1260
Reputation: 17681
In order to run an ASP.NET Core application make sure you:
web.config
The hosting bundle includes the ASP.NET Core Module for IIS which allows IIS to launch. Without ASP.NET Core apps will not run on IIS.
You also need to publish your application, which produces a final output folder that contains your binaries and config files including a web.config
in the root and a wwwroot
root folder with your content. To test you should make sure you can run your app from the command line with:
dotnet yourMainAssembly.dll -c Release
If this doesn't work fix this first as this is essentially what IIS fires. once the standalone works you can try using IIS.
ASP.NET Core projects created in Visual Studio automatically include a web.config and that should have everything you need to run under IIS. For a basic setup that should be all you need. The generated web.config should take care of getting your app running.
If you're using a virtual you might have an issue with the parent side configuration bleeding into your virtual because virtuals inherit settings from the parent. If that's the case either choose the same version of .NET Framework for your application pool, or share the application pool with the parent. Alternately you can use <clear />
in the <handlers>
section to clear out any handlers from up the hierarchy.
<configuration>
<system.webServer>
<handlers>
<clear>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00">
<environmentVariables />
</aspNetCore>
</system.webServer>
</configuration>
I have a blog post with a lot more details on hosting on IIS along with some additional configuration for static files here:
Upvotes: 2