.net core api not running on IIS
Edit I finally figured this out. I have been working on this for days. So the issue was, we use a hosting panel, which creates an app pool and user for each website. The app pool didn't have access to c:\program files\dotnet. There are a couple fixes. One was I could grant that specific user access to that folder, but I didn't like that option. I changed the app pool for my website to use the default app pool identity user, then granted IIS_IUSRS read/write perms and now it's working!
I followed this tutorial as I'm trying to run a .net core api through IIS. As of right now, my site is literally the default template if you pick the .net core web api option from create new project. I can run it and get the default values controller to show up.
However, if I put it on my IIS server, I get a 502 error. Looking at the event viewer, here is what it says
Application 'MACHINE/WEBROOT/APPHOST/myapi.COM' with physical root 'C:\Inetpub\vhosts\myapi.com\httpdocs\' failed to start process with commandline 'dotnet .\Api.dll', ErrorCode = '0x80070002 : 0.
I know it's not a file perms issue as I temporarily granted the user everyone full access to the folder, just to rule that out.
Any ideas what is going on here? I can post my entire project or specific files if you want, as I said, it's just the default published version of the api. My web config is below. The last thing i'll note, if I browse to this on the server itself and run dotnet api.dll from the command line, the thing spins up and I can access it just fine at localhost:5000 on the server itself. Does the port have something to do with that?
<?xml version="1.0" encoding="utf-8"?> <configuration> <location path="." inheritInChildApplications="false"> <system.webServer> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" /> </handlers> <aspNetCore processPath="dotnet" arguments=".\Api.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" /> </system.webServer> </location> </configuration>
0 comments:
Post a Comment