3

ASP.NET Core seems to package a Kestrel service inside a .exe file.

All the instructions I've looked at for hosting ASP.NET Core apps in IIS seem to reference having an entry point (Main() method) inside a DLL.

How do I stage the .exe file such that IIS recognizes it?

I don't see that part of the publishing process, and I would think that would be a very common step seeing as that is the default output of ASP.NET Core.

0

2 Answers 2

5

We did this by adding the following to the web.config file. Note the processPath attribute.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath=".\MyDotNetCoreApp.exe" />
  </system.webServer>
</configuration>
Sign up to request clarification or add additional context in comments.

Comments

1

First create a AppPool with No Managed code:

enter image description here

Then create a Website in IIS, I set it to port 8888 (as the default website uses port 80) point it to the web publish directory:

enter image description here

The website uses the AppPool with no managed code:

enter image description here

In the Web.Config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\AdviserPaymentList.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
</configuration>

Then browse to http://localhost:8888/Home, any problems look at the logs.

2 Comments

Thanks! I noticed your arguments references a .dll file whereas ASP.NET Core outputs an exe by default. Did you just change your project to a DLL? Is there a way to host an exe?
You don't actually answer the question about hosting the published exe-file :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.